blob: e1f033e20e3671383ef4b6e150f0aeb277519346 [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
269// This file is auto-generated by generate_glslang_parser.sh. DO NOT EDIT!
270
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}
zmo@google.comfd747b82011-04-23 01:30:07 +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_
zmo@google.comfd747b82011-04-23 01:30:07 +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. */
zmo@google.com09c323a2011-08-12 18:22:25 +0000585#define YYLAST 1381
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. */
590#define YYNNTS 78
591/* YYNRULES -- Number of rules. */
zmo@google.com09c323a2011-08-12 18:22:25 +0000592#define YYNRULES 194
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000593/* YYNRULES -- Number of states. */
zmo@google.com09c323a2011-08-12 18:22:25 +0000594#define YYNSTATES 297
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,
zmo@google.com09c323a2011-08-12 18:22:25 +0000661 368, 370, 372, 374, 376, 378, 380, 382, 388, 393,
662 395, 398, 402, 404, 408, 410, 415, 417, 419, 421,
663 423, 425, 427, 429, 431, 433, 436, 437, 438, 444,
664 446, 448, 451, 455, 457, 460, 462, 465, 471, 475,
665 477, 479, 484, 485, 492, 493, 502, 503, 511, 513,
666 515, 517, 518, 521, 525, 528, 531, 534, 538, 541,
667 543, 546, 548, 550, 551
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{
zmo@google.com09c323a2011-08-12 18:22:25 +0000673 169, 0, -1, 44, -1, 96, -1, 47, -1, 46,
674 -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,
701 147, -1, 136, -1, 136, 44, -1, 136, 44, 73,
702 74, -1, 136, 44, 73, 124, 74, -1, 136, 44,
703 80, 147, -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,
711 45, -1, 38, 44, 75, 143, 76, -1, 38, 75,
712 143, 76, -1, 144, -1, 143, 144, -1, 138, 145,
713 81, -1, 146, -1, 145, 78, 146, -1, 44, -1,
714 44, 73, 124, 74, -1, 121, -1, 125, -1, 151,
715 -1, 150, -1, 148, -1, 157, -1, 158, -1, 161,
716 -1, 168, -1, 75, 76, -1, -1, -1, 75, 152,
717 156, 153, 76, -1, 155, -1, 150, -1, 75, 76,
718 -1, 75, 156, 76, -1, 149, -1, 156, 149, -1,
719 81, -1, 123, 81, -1, 18, 71, 123, 72, 159,
720 -1, 149, 16, 149, -1, 149, -1, 123, -1, 136,
721 44, 80, 147, -1, -1, 40, 71, 162, 160, 72,
722 154, -1, -1, 15, 163, 149, 40, 71, 123, 72,
723 81, -1, -1, 17, 71, 164, 165, 167, 72, 154,
724 -1, 157, -1, 148, -1, 160, -1, -1, 166, 81,
725 -1, 166, 81, 123, -1, 14, 81, -1, 13, 81,
726 -1, 20, 81, -1, 20, 123, 81, -1, 19, 81,
727 -1, 170, -1, 169, 170, -1, 171, -1, 125, -1,
728 -1, 126, 172, 155, -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,
zmo@google.com09c323a2011-08-12 18:22:25 +0000747 1596, 1602, 1608, 1613, 1618, 1627, 1632, 1645, 1658, 1666,
748 1669, 1684, 1716, 1720, 1726, 1734, 1750, 1754, 1758, 1759,
749 1765, 1766, 1767, 1768, 1769, 1773, 1774, 1774, 1774, 1784,
750 1785, 1790, 1793, 1803, 1806, 1812, 1813, 1817, 1825, 1829,
751 1839, 1844, 1861, 1861, 1866, 1866, 1873, 1873, 1881, 1884,
752 1890, 1893, 1899, 1903, 1910, 1917, 1924, 1931, 1942, 1951,
753 1955, 1962, 1965, 1971, 1971
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",
797 "struct_declaration_list", "struct_declaration",
798 "struct_declarator_list", "struct_declarator", "initializer",
799 "declaration_statement", "statement", "simple_statement",
800 "compound_statement", "@1", "@2", "statement_no_new_scope",
801 "compound_statement_no_new_scope", "statement_list",
802 "expression_statement", "selection_statement",
803 "selection_rest_statement", "condition", "iteration_statement", "@3",
804 "@4", "@5", "for_init_statement", "conditionopt", "for_rest_statement",
805 "jump_statement", "translation_unit", "external_declaration",
806 "function_definition", "@6", 0
807};
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,
844 141, 141, 141, 141, 141, 141, 141, 142, 142, 143,
845 143, 144, 145, 145, 146, 146, 147, 148, 149, 149,
846 150, 150, 150, 150, 150, 151, 152, 153, 151, 154,
847 154, 155, 155, 156, 156, 157, 157, 158, 159, 159,
848 160, 160, 162, 161, 163, 161, 164, 161, 165, 165,
849 166, 166, 167, 167, 168, 168, 168, 168, 168, 169,
850 169, 170, 170, 172, 171
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,
zmo@google.com09c323a2011-08-12 18:22:25 +0000869 1, 1, 1, 1, 1, 1, 1, 5, 4, 1,
870 2, 3, 1, 3, 1, 4, 1, 1, 1, 1,
871 1, 1, 1, 1, 1, 2, 0, 0, 5, 1,
872 1, 2, 3, 1, 2, 1, 2, 5, 3, 1,
873 1, 4, 0, 6, 0, 8, 0, 7, 1, 1,
874 1, 0, 2, 3, 2, 2, 2, 3, 2, 1,
875 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,
886 136, 192, 193, 0, 76, 86, 0, 91, 96, 0,
887 102, 0, 109, 114, 135, 0, 189, 191, 107, 101,
888 0, 0, 0, 71, 0, 74, 86, 0, 87, 88,
889 89, 77, 0, 86, 0, 72, 97, 103, 110, 0,
890 1, 190, 0, 0, 0, 0, 139, 0, 194, 78,
891 83, 85, 90, 0, 92, 79, 0, 0, 2, 5,
892 4, 6, 27, 0, 0, 0, 34, 33, 32, 3,
893 8, 28, 10, 15, 16, 0, 0, 21, 0, 35,
894 0, 38, 41, 42, 47, 50, 51, 52, 53, 55,
895 57, 59, 70, 0, 25, 73, 0, 144, 0, 142,
896 138, 140, 0, 0, 174, 0, 0, 0, 0, 0,
897 156, 161, 165, 35, 61, 68, 0, 147, 0, 114,
898 150, 163, 149, 148, 0, 151, 152, 153, 154, 80,
899 82, 84, 0, 0, 98, 0, 146, 100, 29, 30,
900 0, 12, 13, 0, 0, 19, 18, 0, 20, 22,
901 24, 31, 0, 0, 0, 0, 0, 0, 0, 0,
902 0, 0, 0, 0, 0, 0, 115, 137, 0, 0,
903 141, 185, 184, 0, 176, 0, 188, 186, 0, 172,
904 155, 0, 64, 65, 66, 67, 63, 0, 0, 166,
905 162, 164, 0, 93, 0, 95, 99, 7, 0, 14,
906 26, 11, 17, 23, 36, 37, 40, 39, 45, 46,
907 43, 44, 48, 49, 54, 56, 58, 0, 0, 143,
908 0, 0, 0, 187, 0, 157, 62, 69, 0, 94,
909 9, 0, 145, 0, 179, 178, 181, 0, 170, 0,
910 0, 0, 81, 60, 0, 180, 0, 0, 169, 167,
911 0, 0, 158, 0, 182, 0, 0, 0, 160, 173,
912 159, 0, 183, 177, 168, 171, 175
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000913};
914
915/* YYDEFGOTO[NTERM-NUM]. */
916static const yytype_int16 yydefgoto[] =
917{
zmo@google.com09c323a2011-08-12 18:22:25 +0000918 -1, 99, 100, 101, 228, 102, 103, 104, 105, 106,
919 107, 108, 143, 110, 111, 112, 113, 114, 115, 116,
920 117, 118, 119, 120, 121, 144, 145, 217, 146, 123,
921 147, 148, 33, 34, 35, 80, 61, 62, 81, 36,
922 37, 38, 39, 40, 41, 42, 124, 44, 75, 76,
923 128, 129, 167, 150, 151, 152, 153, 211, 271, 289,
924 290, 154, 155, 156, 279, 270, 157, 254, 203, 251,
925 266, 276, 277, 158, 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. */
zmo@google.com09c323a2011-08-12 18:22:25 +0000930#define YYPACT_NINF -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000931static const yytype_int16 yypact[] =
932{
zmo@google.com09c323a2011-08-12 18:22:25 +0000933 1233, -19, -251, -251, -251, 130, -251, -251, -251, -251,
934 -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,
935 -251, -251, -251, -251, -251, -24, -251, -251, -251, -251,
936 -251, -251, -62, -6, 17, 34, -20, -251, 36, 1275,
937 -251, 1336, -251, 32, -251, 1190, -251, -251, -251, -251,
938 1336, 44, 1275, -251, 47, -251, 51, 78, -251, -251,
939 -251, -251, 1275, 109, 81, -251, -50, -251, -251, 959,
940 -251, -251, 56, 1275, 102, 1092, -251, 284, -251, -251,
941 -251, -251, 111, 1275, -44, -251, 764, 959, 87, -251,
942 -251, -251, -251, 959, 959, 959, -251, -251, -251, -251,
943 -251, 37, -251, -251, -251, 89, 22, 1024, 88, -251,
944 959, -54, -9, -251, -43, 92, -251, -251, -251, 105,
945 104, -45, -251, 91, -251, -251, 1134, 93, 15, -251,
946 -251, -251, 86, 90, -251, 97, 98, 94, 829, 99,
947 101, -251, -251, 2, -251, -251, 31, -251, -62, 74,
948 -251, -251, -251, -251, 367, -251, -251, -251, -251, 100,
949 -251, -251, 894, 959, -251, 107, -251, -251, -251, -251,
950 25, -251, -251, 959, 1300, -251, -251, 959, 103, -251,
951 -251, -251, 959, 959, 959, 959, 959, 959, 959, 959,
952 959, 959, 959, 959, 959, 959, -251, -251, 959, 102,
953 -251, -251, -251, 450, -251, 959, -251, -251, 40, -251,
954 -251, 450, -251, -251, -251, -251, -251, 959, 959, -251,
955 -251, -251, 959, -251, 108, -251, -251, -251, 110, 113,
956 -251, 112, -251, -251, -251, -251, -54, -54, -251, -251,
957 -251, -251, -43, -43, -251, 105, 104, 72, 114, -251,
958 138, 616, 26, -251, 699, 450, -251, -251, 115, -251,
959 -251, 959, -251, 116, -251, -251, 699, 450, 113, 135,
960 121, 118, -251, -251, 959, -251, 117, 123, 169, -251,
961 106, 533, -251, 35, 959, 533, 450, 959, -251, -251,
962 -251, 119, 113, -251, -251, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000963};
964
965/* YYPGOTO[NTERM-NUM]. */
966static const yytype_int16 yypgoto[] =
967{
zmo@google.com09c323a2011-08-12 18:22:25 +0000968 -251, -251, -251, -251, -251, -251, -251, 23, -251, -251,
969 -251, -251, 30, -251, -32, -251, -58, -34, -251, -251,
970 -251, 4, 6, 7, -251, -60, -85, -251, -94, -81,
971 8, 10, -251, -251, -251, 122, 148, 143, 124, -251,
972 -251, -238, -22, -35, 203, -26, 0, -251, 136, -69,
973 -251, 11, -160, -25, -147, -250, -251, -251, -251, -56,
974 171, 16, -21, -251, -251, -33, -251, -251, -251, -251,
975 -251, -251, -251, -251, -251, 186, -251, -251
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{
zmo@google.com09c323a2011-08-12 18:22:25 +0000985 43, 170, 166, 225, 67, 165, 131, 221, 31, 122,
986 32, 186, 187, 63, 194, 68, 269, 74, 48, 53,
987 51, 85, 179, 86, 72, 49, 122, 82, 269, 162,
988 87, 288, 182, 183, 63, 288, 163, 57, 74, 43,
989 74, 43, 6, 7, 208, 43, 188, 189, 82, 195,
990 43, 52, 43, 31, 57, 32, 250, 131, 64, 6,
991 7, 65, 43, 212, 213, 214, 55, 58, 59, 60,
992 23, 24, 215, 43, 184, 43, 185, 149, 166, 229,
993 66, 224, 216, 43, 58, 59, 60, 23, 24, 171,
994 172, 74, 233, 199, 176, 56, 200, 227, 267, 109,
995 177, 247, 122, 218, 218, 69, -75, 291, 221, 218,
996 173, 252, 219, 218, 174, 48, 109, 248, 218, 73,
997 278, 253, 77, 168, 169, 84, 43, 295, 238, 239,
998 240, 241, 256, 257, 2, 3, 4, 125, 122, 294,
999 181, 258, 58, 59, 60, -25, 127, 69, 190, 191,
1000 218, 261, 236, 237, 149, 159, 242, 243, -26, 180,
1001 268, 175, 122, 192, 193, 196, 198, 201, 204, 205,
1002 209, 202, 268, 222, -116, 206, 273, 210, 263, 280,
1003 283, 226, 259, -27, 260, 286, 287, 274, 262, 272,
1004 292, 218, 109, 281, 282, 285, 244, 232, 284, 245,
1005 296, 246, 166, 149, 79, 160, 83, 161, 50, 126,
1006 249, 149, 234, 235, 109, 109, 109, 109, 109, 109,
1007 109, 109, 109, 109, 109, 78, 264, 255, 109, 293,
1008 265, 71, 0, 275, 0, 0, 0, 0, 0, 0,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001009 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001010 0, 149, 109, 0, 149, 149, 0, 0, 0, 0,
1011 0, 0, 0, 0, 0, 0, 149, 149, 0, 0,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001012 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001013 0, 149, 0, 0, 0, 149, 149, 1, 2, 3,
1014 4, 5, 6, 7, 8, 9, 10, 132, 133, 134,
1015 0, 135, 136, 137, 138, 11, 12, 13, 14, 15,
1016 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1017 23, 24, 25, 26, 139, 27, 28, 29, 88, 30,
1018 89, 90, 91, 92, 0, 0, 93, 94, 0, 0,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001019 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001020 0, 0, 0, 0, 0, 95, 0, 0, 0, 140,
1021 141, 0, 0, 0, 0, 142, 96, 97, 0, 98,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001022 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
zmo@google.com09c323a2011-08-12 18:22:25 +00001023 132, 133, 134, 0, 135, 136, 137, 138, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001024 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
zmo@google.com09c323a2011-08-12 18:22:25 +00001025 0, 0, 0, 23, 24, 25, 26, 139, 27, 28,
1026 29, 88, 30, 89, 90, 91, 92, 0, 0, 93,
1027 94, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1028 0, 0, 0, 0, 0, 0, 0, 0, 95, 0,
1029 0, 0, 140, 220, 0, 0, 0, 0, 142, 96,
1030 97, 0, 98, 1, 2, 3, 4, 5, 6, 7,
1031 8, 9, 10, 132, 133, 134, 0, 135, 136, 137,
1032 138, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1033 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
1034 139, 27, 28, 29, 88, 30, 89, 90, 91, 92,
1035 0, 0, 93, 94, 0, 0, 0, 0, 0, 0,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001036 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001037 0, 95, 0, 0, 0, 140, 0, 0, 0, 0,
1038 0, 142, 96, 97, 0, 98, 1, 2, 3, 4,
1039 5, 6, 7, 8, 9, 10, 132, 133, 134, 0,
1040 135, 136, 137, 138, 11, 12, 13, 14, 15, 16,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001041 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
zmo@google.com09c323a2011-08-12 18:22:25 +00001042 24, 25, 26, 139, 27, 28, 29, 88, 30, 89,
1043 90, 91, 92, 0, 0, 93, 94, 0, 0, 0,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001044 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001045 0, 0, 0, 0, 95, 0, 0, 0, 77, 0,
1046 0, 0, 0, 0, 142, 96, 97, 0, 98, 1,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001047 2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001048 0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001049 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001050 0, 0, 23, 24, 25, 26, 0, 27, 28, 29,
1051 88, 30, 89, 90, 91, 92, 0, 0, 93, 94,
1052 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1053 0, 0, 0, 0, 0, 0, 0, 95, 0, 0,
1054 0, 0, 0, 0, 0, 0, 0, 142, 96, 97,
1055 0, 98, 57, 2, 3, 4, 0, 6, 7, 8,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001056 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
1057 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
zmo@google.com09c323a2011-08-12 18:22:25 +00001058 21, 22, 0, 0, 0, 23, 24, 25, 26, 0,
1059 27, 28, 29, 88, 30, 89, 90, 91, 92, 0,
1060 0, 93, 94, 0, 0, 0, 0, 0, 0, 0,
1061 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1062 95, 0, 0, 0, 8, 9, 10, 0, 0, 0,
1063 0, 96, 97, 0, 98, 11, 12, 13, 14, 15,
1064 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1065 0, 0, 25, 26, 0, 27, 28, 29, 88, 30,
1066 89, 90, 91, 92, 0, 0, 93, 94, 0, 0,
1067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1068 0, 0, 0, 0, 0, 95, 0, 0, 164, 8,
1069 9, 10, 0, 0, 0, 0, 96, 97, 0, 98,
1070 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1071 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1072 27, 28, 29, 88, 30, 89, 90, 91, 92, 0,
1073 0, 93, 94, 0, 0, 0, 0, 0, 0, 0,
1074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1075 95, 0, 0, 0, 8, 9, 10, 0, 0, 0,
1076 207, 96, 97, 0, 98, 11, 12, 13, 14, 15,
1077 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1078 0, 0, 25, 26, 0, 27, 28, 29, 88, 30,
1079 89, 90, 91, 92, 0, 0, 93, 94, 0, 0,
1080 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1081 0, 0, 0, 0, 0, 95, 0, 0, 223, 8,
1082 9, 10, 0, 0, 0, 0, 96, 97, 0, 98,
1083 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1084 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1085 27, 28, 29, 88, 30, 89, 90, 91, 92, 0,
1086 0, 93, 94, 0, 0, 0, 0, 0, 0, 0,
1087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1088 95, 0, 0, 0, 8, 9, 10, 0, 0, 0,
1089 0, 96, 97, 0, 98, 11, 12, 13, 14, 15,
1090 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1091 0, 0, 25, 178, 0, 27, 28, 29, 88, 30,
1092 89, 90, 91, 92, 0, 0, 93, 94, 0, 0,
1093 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1094 0, 0, 0, 0, 0, 95, 2, 3, 4, 0,
1095 0, 0, 8, 9, 10, 0, 96, 97, 0, 98,
1096 0, 0, 0, 11, 12, 13, 14, 15, 16, 17,
1097 18, 19, 20, 21, 22, 0, 0, 0, 0, 0,
1098 25, 26, 0, 27, 28, 29, 0, 30, 2, 3,
1099 4, 0, 0, 0, 8, 9, 10, 0, 0, 0,
1100 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
1101 16, 17, 18, 19, 20, 21, 22, 0, 130, 0,
1102 0, 0, 25, 26, 0, 27, 28, 29, 0, 30,
1103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1104 70, 0, 0, 1, 2, 3, 4, 5, 6, 7,
1105 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
1106 197, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1107 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
1108 0, 27, 28, 29, 0, 30, 1, 2, 3, 4,
1109 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1110 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1111 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1112 24, 25, 26, 0, 27, 28, 29, 0, 30, 2,
1113 3, 4, 0, 0, 0, 8, 9, 10, 0, 0,
1114 0, 0, 0, 0, 0, 0, 11, 12, 13, 14,
1115 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1116 8, 9, 10, 25, 26, 0, 27, 28, 29, 0,
1117 30, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1118 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
1119 0, 27, 28, 29, 230, 30, 8, 9, 10, 231,
1120 0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
1121 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1122 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1123 0, 30
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001124};
1125
1126static const yytype_int16 yycheck[] =
1127{
zmo@google.com09c323a2011-08-12 18:22:25 +00001128 0, 95, 87, 163, 39, 86, 75, 154, 0, 69,
1129 0, 54, 55, 35, 59, 41, 254, 52, 37, 81,
1130 44, 71, 107, 73, 50, 44, 86, 62, 266, 73,
1131 80, 281, 86, 87, 56, 285, 80, 3, 73, 39,
1132 75, 41, 8, 9, 138, 45, 89, 90, 83, 94,
1133 50, 75, 52, 45, 3, 45, 203, 126, 78, 8,
1134 9, 81, 62, 61, 62, 63, 72, 33, 34, 35,
1135 36, 37, 70, 73, 83, 75, 85, 77, 163, 173,
1136 44, 162, 80, 83, 33, 34, 35, 36, 37, 52,
1137 53, 126, 177, 78, 72, 78, 81, 72, 72, 69,
1138 78, 195, 162, 78, 78, 73, 72, 72, 255, 78,
1139 73, 205, 81, 78, 77, 37, 86, 198, 78, 75,
1140 267, 81, 75, 93, 94, 44, 126, 287, 186, 187,
1141 188, 189, 217, 218, 4, 5, 6, 81, 198, 286,
1142 110, 222, 33, 34, 35, 71, 44, 73, 56, 57,
1143 78, 79, 184, 185, 154, 44, 190, 191, 71, 71,
1144 254, 72, 222, 58, 60, 74, 73, 81, 71, 71,
1145 71, 81, 266, 73, 71, 81, 261, 76, 40, 44,
1146 274, 74, 74, 71, 74, 16, 80, 71, 74, 74,
1147 284, 78, 162, 72, 76, 72, 192, 174, 81, 193,
1148 81, 194, 287, 203, 56, 83, 63, 83, 5, 73,
1149 199, 211, 182, 183, 184, 185, 186, 187, 188, 189,
1150 190, 191, 192, 193, 194, 54, 251, 211, 198, 285,
1151 251, 45, -1, 266, -1, -1, -1, -1, -1, -1,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001152 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001153 -1, 251, 222, -1, 254, 255, -1, -1, -1, -1,
1154 -1, -1, -1, -1, -1, -1, 266, 267, -1, -1,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001155 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001156 -1, 281, -1, -1, -1, 285, 286, 3, 4, 5,
1157 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1158 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1159 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1160 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
1161 46, 47, 48, 49, -1, -1, 52, 53, -1, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001162 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001163 -1, -1, -1, -1, -1, 71, -1, -1, -1, 75,
1164 76, -1, -1, -1, -1, 81, 82, 83, -1, 85,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001165 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1166 13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
1167 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1168 -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
zmo@google.com09c323a2011-08-12 18:22:25 +00001169 43, 44, 45, 46, 47, 48, 49, -1, -1, 52,
1170 53, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1171 -1, -1, -1, -1, -1, -1, -1, -1, 71, -1,
1172 -1, -1, 75, 76, -1, -1, -1, -1, 81, 82,
1173 83, -1, 85, 3, 4, 5, 6, 7, 8, 9,
1174 10, 11, 12, 13, 14, 15, -1, 17, 18, 19,
1175 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1176 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1177 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1178 -1, -1, 52, 53, -1, -1, -1, -1, -1, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001179 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001180 -1, 71, -1, -1, -1, 75, -1, -1, -1, -1,
1181 -1, 81, 82, 83, -1, 85, 3, 4, 5, 6,
1182 7, 8, 9, 10, 11, 12, 13, 14, 15, -1,
1183 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001184 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
zmo@google.com09c323a2011-08-12 18:22:25 +00001185 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1186 47, 48, 49, -1, -1, 52, 53, -1, -1, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001187 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001188 -1, -1, -1, -1, 71, -1, -1, -1, 75, -1,
1189 -1, -1, -1, -1, 81, 82, 83, -1, 85, 3,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001190 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001191 -1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001192 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001193 -1, -1, 36, 37, 38, 39, -1, 41, 42, 43,
1194 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
1195 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1196 -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
1197 -1, -1, -1, -1, -1, -1, -1, 81, 82, 83,
1198 -1, 85, 3, 4, 5, 6, -1, 8, 9, 10,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001199 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1200 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
zmo@google.com09c323a2011-08-12 18:22:25 +00001201 31, 32, -1, -1, -1, 36, 37, 38, 39, -1,
1202 41, 42, 43, 44, 45, 46, 47, 48, 49, -1,
1203 -1, 52, 53, -1, -1, -1, -1, -1, -1, -1,
1204 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1205 71, -1, -1, -1, 10, 11, 12, -1, -1, -1,
1206 -1, 82, 83, -1, 85, 21, 22, 23, 24, 25,
1207 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1208 -1, -1, 38, 39, -1, 41, 42, 43, 44, 45,
1209 46, 47, 48, 49, -1, -1, 52, 53, -1, -1,
1210 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1211 -1, -1, -1, -1, -1, 71, -1, -1, 74, 10,
1212 11, 12, -1, -1, -1, -1, 82, 83, -1, 85,
1213 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1214 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1215 41, 42, 43, 44, 45, 46, 47, 48, 49, -1,
1216 -1, 52, 53, -1, -1, -1, -1, -1, -1, -1,
1217 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1218 71, -1, -1, -1, 10, 11, 12, -1, -1, -1,
1219 81, 82, 83, -1, 85, 21, 22, 23, 24, 25,
1220 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1221 -1, -1, 38, 39, -1, 41, 42, 43, 44, 45,
1222 46, 47, 48, 49, -1, -1, 52, 53, -1, -1,
1223 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1224 -1, -1, -1, -1, -1, 71, -1, -1, 74, 10,
1225 11, 12, -1, -1, -1, -1, 82, 83, -1, 85,
1226 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1227 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1228 41, 42, 43, 44, 45, 46, 47, 48, 49, -1,
1229 -1, 52, 53, -1, -1, -1, -1, -1, -1, -1,
1230 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1231 71, -1, -1, -1, 10, 11, 12, -1, -1, -1,
1232 -1, 82, 83, -1, 85, 21, 22, 23, 24, 25,
1233 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1234 -1, -1, 38, 39, -1, 41, 42, 43, 44, 45,
1235 46, 47, 48, 49, -1, -1, 52, 53, -1, -1,
1236 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1237 -1, -1, -1, -1, -1, 71, 4, 5, 6, -1,
1238 -1, -1, 10, 11, 12, -1, 82, 83, -1, 85,
1239 -1, -1, -1, 21, 22, 23, 24, 25, 26, 27,
1240 28, 29, 30, 31, 32, -1, -1, -1, -1, -1,
1241 38, 39, -1, 41, 42, 43, -1, 45, 4, 5,
1242 6, -1, -1, -1, 10, 11, 12, -1, -1, -1,
1243 -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
1244 26, 27, 28, 29, 30, 31, 32, -1, 76, -1,
1245 -1, -1, 38, 39, -1, 41, 42, 43, -1, 45,
1246 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1247 0, -1, -1, 3, 4, 5, 6, 7, 8, 9,
1248 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1249 76, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1250 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1251 -1, 41, 42, 43, -1, 45, 3, 4, 5, 6,
1252 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1253 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1254 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1255 37, 38, 39, -1, 41, 42, 43, -1, 45, 4,
1256 5, 6, -1, -1, -1, 10, 11, 12, -1, -1,
1257 -1, -1, -1, -1, -1, -1, 21, 22, 23, 24,
1258 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
1259 10, 11, 12, 38, 39, -1, 41, 42, 43, -1,
1260 45, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1261 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1262 -1, 41, 42, 43, 44, 45, 10, 11, 12, 49,
1263 -1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
1264 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1265 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1266 -1, 45
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001267};
1268
1269/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1270 symbol of state STATE-NUM. */
1271static const yytype_uint8 yystos[] =
1272{
1273 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1274 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001275 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
1276 45, 125, 126, 127, 128, 129, 134, 135, 136, 137,
1277 138, 139, 140, 141, 142, 169, 170, 171, 37, 44,
1278 139, 44, 75, 81, 172, 72, 78, 3, 33, 34,
1279 35, 131, 132, 137, 78, 81, 44, 138, 140, 73,
1280 0, 170, 140, 75, 138, 143, 144, 75, 155, 131,
1281 130, 133, 138, 132, 44, 71, 73, 80, 44, 46,
1282 47, 48, 49, 52, 53, 71, 82, 83, 85, 96,
1283 97, 98, 100, 101, 102, 103, 104, 105, 106, 107,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001284 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
zmo@google.com09c323a2011-08-12 18:22:25 +00001285 118, 119, 120, 124, 141, 81, 143, 44, 145, 146,
1286 76, 144, 13, 14, 15, 17, 18, 19, 20, 40,
1287 75, 76, 81, 107, 120, 121, 123, 125, 126, 141,
1288 148, 149, 150, 151, 156, 157, 158, 161, 168, 44,
1289 130, 133, 73, 80, 74, 124, 121, 147, 107, 107,
1290 123, 52, 53, 73, 77, 72, 72, 78, 39, 121,
1291 71, 107, 86, 87, 83, 85, 54, 55, 89, 90,
1292 56, 57, 58, 60, 59, 94, 74, 76, 73, 78,
1293 81, 81, 81, 163, 71, 71, 81, 81, 123, 71,
1294 76, 152, 61, 62, 63, 70, 80, 122, 78, 81,
1295 76, 149, 73, 74, 124, 147, 74, 72, 99, 123,
1296 44, 49, 102, 121, 107, 107, 109, 109, 111, 111,
1297 111, 111, 112, 112, 116, 117, 118, 123, 124, 146,
1298 149, 164, 123, 81, 162, 156, 121, 121, 124, 74,
1299 74, 79, 74, 40, 148, 157, 165, 72, 123, 136,
1300 160, 153, 74, 121, 71, 160, 166, 167, 149, 159,
1301 44, 72, 76, 123, 81, 72, 16, 80, 150, 154,
1302 155, 72, 123, 154, 149, 147, 81
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001303};
1304
1305#define yyerrok (yyerrstatus = 0)
1306#define yyclearin (yychar = YYEMPTY)
1307#define YYEMPTY (-2)
1308#define YYEOF 0
1309
1310#define YYACCEPT goto yyacceptlab
1311#define YYABORT goto yyabortlab
1312#define YYERROR goto yyerrorlab
1313
1314
1315/* Like YYERROR except do call yyerror. This remains here temporarily
1316 to ease the transition to the new meaning of YYERROR, for GCC.
1317 Once GCC version 2 has supplanted version 1, this can go. */
1318
1319#define YYFAIL goto yyerrlab
1320
1321#define YYRECOVERING() (!!yyerrstatus)
1322
1323#define YYBACKUP(Token, Value) \
1324do \
1325 if (yychar == YYEMPTY && yylen == 1) \
1326 { \
1327 yychar = (Token); \
1328 yylval = (Value); \
1329 yytoken = YYTRANSLATE (yychar); \
1330 YYPOPSTACK (1); \
1331 goto yybackup; \
1332 } \
1333 else \
1334 { \
1335 yyerror (context, YY_("syntax error: cannot back up")); \
1336 YYERROR; \
1337 } \
1338while (YYID (0))
1339
1340
1341#define YYTERROR 1
1342#define YYERRCODE 256
1343
1344
1345/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1346 If N is 0, then set CURRENT to the empty location which ends
1347 the previous symbol: RHS[0] (always defined). */
1348
1349#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1350#ifndef YYLLOC_DEFAULT
1351# define YYLLOC_DEFAULT(Current, Rhs, N) \
1352 do \
1353 if (YYID (N)) \
1354 { \
1355 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1356 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1357 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1358 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1359 } \
1360 else \
1361 { \
1362 (Current).first_line = (Current).last_line = \
1363 YYRHSLOC (Rhs, 0).last_line; \
1364 (Current).first_column = (Current).last_column = \
1365 YYRHSLOC (Rhs, 0).last_column; \
1366 } \
1367 while (YYID (0))
1368#endif
1369
1370
1371/* YY_LOCATION_PRINT -- Print the location on the stream.
1372 This macro was not mandated originally: define only if we know
1373 we won't break user code: when these are the locations we know. */
1374
1375#ifndef YY_LOCATION_PRINT
zmo@google.comfd747b82011-04-23 01:30:07 +00001376# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001377# define YY_LOCATION_PRINT(File, Loc) \
1378 fprintf (File, "%d.%d-%d.%d", \
1379 (Loc).first_line, (Loc).first_column, \
1380 (Loc).last_line, (Loc).last_column)
1381# else
1382# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1383# endif
1384#endif
1385
1386
1387/* YYLEX -- calling `yylex' with the right arguments. */
1388
1389#ifdef YYLEX_PARAM
1390# define YYLEX yylex (&yylval, YYLEX_PARAM)
1391#else
1392# define YYLEX yylex (&yylval)
1393#endif
1394
1395/* Enable debugging if requested. */
1396#if YYDEBUG
1397
1398# ifndef YYFPRINTF
1399# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1400# define YYFPRINTF fprintf
1401# endif
1402
1403# define YYDPRINTF(Args) \
1404do { \
1405 if (yydebug) \
1406 YYFPRINTF Args; \
1407} while (YYID (0))
1408
1409# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1410do { \
1411 if (yydebug) \
1412 { \
1413 YYFPRINTF (stderr, "%s ", Title); \
1414 yy_symbol_print (stderr, \
1415 Type, Value, context); \
1416 YYFPRINTF (stderr, "\n"); \
1417 } \
1418} while (YYID (0))
1419
1420
1421/*--------------------------------.
1422| Print this symbol on YYOUTPUT. |
1423`--------------------------------*/
1424
1425/*ARGSUSED*/
1426#if (defined __STDC__ || defined __C99__FUNC__ \
1427 || defined __cplusplus || defined _MSC_VER)
1428static void
1429yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1430#else
1431static void
1432yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1433 FILE *yyoutput;
1434 int yytype;
1435 YYSTYPE const * const yyvaluep;
1436 TParseContext* context;
1437#endif
1438{
1439 if (!yyvaluep)
1440 return;
1441 YYUSE (context);
1442# ifdef YYPRINT
1443 if (yytype < YYNTOKENS)
1444 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1445# else
1446 YYUSE (yyoutput);
1447# endif
1448 switch (yytype)
1449 {
1450 default:
1451 break;
1452 }
1453}
1454
1455
1456/*--------------------------------.
1457| Print this symbol on YYOUTPUT. |
1458`--------------------------------*/
1459
1460#if (defined __STDC__ || defined __C99__FUNC__ \
1461 || defined __cplusplus || defined _MSC_VER)
1462static void
1463yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1464#else
1465static void
1466yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1467 FILE *yyoutput;
1468 int yytype;
1469 YYSTYPE const * const yyvaluep;
1470 TParseContext* context;
1471#endif
1472{
1473 if (yytype < YYNTOKENS)
1474 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1475 else
1476 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1477
1478 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1479 YYFPRINTF (yyoutput, ")");
1480}
1481
1482/*------------------------------------------------------------------.
1483| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1484| TOP (included). |
1485`------------------------------------------------------------------*/
1486
1487#if (defined __STDC__ || defined __C99__FUNC__ \
1488 || defined __cplusplus || defined _MSC_VER)
1489static void
1490yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1491#else
1492static void
1493yy_stack_print (bottom, top)
1494 yytype_int16 *bottom;
1495 yytype_int16 *top;
1496#endif
1497{
1498 YYFPRINTF (stderr, "Stack now");
1499 for (; bottom <= top; ++bottom)
1500 YYFPRINTF (stderr, " %d", *bottom);
1501 YYFPRINTF (stderr, "\n");
1502}
1503
1504# define YY_STACK_PRINT(Bottom, Top) \
1505do { \
1506 if (yydebug) \
1507 yy_stack_print ((Bottom), (Top)); \
1508} while (YYID (0))
1509
1510
1511/*------------------------------------------------.
1512| Report that the YYRULE is going to be reduced. |
1513`------------------------------------------------*/
1514
1515#if (defined __STDC__ || defined __C99__FUNC__ \
1516 || defined __cplusplus || defined _MSC_VER)
1517static void
1518yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1519#else
1520static void
1521yy_reduce_print (yyvsp, yyrule, context)
1522 YYSTYPE *yyvsp;
1523 int yyrule;
1524 TParseContext* context;
1525#endif
1526{
1527 int yynrhs = yyr2[yyrule];
1528 int yyi;
1529 unsigned long int yylno = yyrline[yyrule];
1530 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1531 yyrule - 1, yylno);
1532 /* The symbols being reduced. */
1533 for (yyi = 0; yyi < yynrhs; yyi++)
1534 {
1535 fprintf (stderr, " $%d = ", yyi + 1);
1536 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1537 &(yyvsp[(yyi + 1) - (yynrhs)])
1538 , context);
1539 fprintf (stderr, "\n");
1540 }
1541}
1542
1543# define YY_REDUCE_PRINT(Rule) \
1544do { \
1545 if (yydebug) \
1546 yy_reduce_print (yyvsp, Rule, context); \
1547} while (YYID (0))
1548
1549/* Nonzero means print parse trace. It is left uninitialized so that
1550 multiple parsers can coexist. */
1551int yydebug;
1552#else /* !YYDEBUG */
1553# define YYDPRINTF(Args)
1554# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1555# define YY_STACK_PRINT(Bottom, Top)
1556# define YY_REDUCE_PRINT(Rule)
1557#endif /* !YYDEBUG */
1558
1559
1560/* YYINITDEPTH -- initial size of the parser's stacks. */
1561#ifndef YYINITDEPTH
1562# define YYINITDEPTH 200
1563#endif
1564
1565/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1566 if the built-in stack extension method is used).
1567
1568 Do not make this value too large; the results are undefined if
1569 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1570 evaluated with infinite-precision integer arithmetic. */
1571
1572#ifndef YYMAXDEPTH
1573# define YYMAXDEPTH 10000
1574#endif
1575
1576
1577
1578#if YYERROR_VERBOSE
1579
1580# ifndef yystrlen
1581# if defined __GLIBC__ && defined _STRING_H
1582# define yystrlen strlen
1583# else
1584/* Return the length of YYSTR. */
1585#if (defined __STDC__ || defined __C99__FUNC__ \
1586 || defined __cplusplus || defined _MSC_VER)
1587static YYSIZE_T
1588yystrlen (const char *yystr)
1589#else
1590static YYSIZE_T
1591yystrlen (yystr)
1592 const char *yystr;
1593#endif
1594{
1595 YYSIZE_T yylen;
1596 for (yylen = 0; yystr[yylen]; yylen++)
1597 continue;
1598 return yylen;
1599}
1600# endif
1601# endif
1602
1603# ifndef yystpcpy
1604# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1605# define yystpcpy stpcpy
1606# else
1607/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1608 YYDEST. */
1609#if (defined __STDC__ || defined __C99__FUNC__ \
1610 || defined __cplusplus || defined _MSC_VER)
1611static char *
1612yystpcpy (char *yydest, const char *yysrc)
1613#else
1614static char *
1615yystpcpy (yydest, yysrc)
1616 char *yydest;
1617 const char *yysrc;
1618#endif
1619{
1620 char *yyd = yydest;
1621 const char *yys = yysrc;
1622
1623 while ((*yyd++ = *yys++) != '\0')
1624 continue;
1625
1626 return yyd - 1;
1627}
1628# endif
1629# endif
1630
1631# ifndef yytnamerr
1632/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1633 quotes and backslashes, so that it's suitable for yyerror. The
1634 heuristic is that double-quoting is unnecessary unless the string
1635 contains an apostrophe, a comma, or backslash (other than
1636 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1637 null, do not copy; instead, return the length of what the result
1638 would have been. */
1639static YYSIZE_T
1640yytnamerr (char *yyres, const char *yystr)
1641{
1642 if (*yystr == '"')
1643 {
1644 YYSIZE_T yyn = 0;
1645 char const *yyp = yystr;
1646
1647 for (;;)
1648 switch (*++yyp)
1649 {
1650 case '\'':
1651 case ',':
1652 goto do_not_strip_quotes;
1653
1654 case '\\':
1655 if (*++yyp != '\\')
1656 goto do_not_strip_quotes;
1657 /* Fall through. */
1658 default:
1659 if (yyres)
1660 yyres[yyn] = *yyp;
1661 yyn++;
1662 break;
1663
1664 case '"':
1665 if (yyres)
1666 yyres[yyn] = '\0';
1667 return yyn;
1668 }
1669 do_not_strip_quotes: ;
1670 }
1671
1672 if (! yyres)
1673 return yystrlen (yystr);
1674
1675 return yystpcpy (yyres, yystr) - yyres;
1676}
1677# endif
1678
1679/* Copy into YYRESULT an error message about the unexpected token
1680 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1681 including the terminating null byte. If YYRESULT is null, do not
1682 copy anything; just return the number of bytes that would be
1683 copied. As a special case, return 0 if an ordinary "syntax error"
1684 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1685 size calculation. */
1686static YYSIZE_T
1687yysyntax_error (char *yyresult, int yystate, int yychar)
1688{
1689 int yyn = yypact[yystate];
1690
1691 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1692 return 0;
1693 else
1694 {
1695 int yytype = YYTRANSLATE (yychar);
1696 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1697 YYSIZE_T yysize = yysize0;
1698 YYSIZE_T yysize1;
1699 int yysize_overflow = 0;
1700 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1701 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1702 int yyx;
1703
1704# if 0
1705 /* This is so xgettext sees the translatable formats that are
1706 constructed on the fly. */
1707 YY_("syntax error, unexpected %s");
1708 YY_("syntax error, unexpected %s, expecting %s");
1709 YY_("syntax error, unexpected %s, expecting %s or %s");
1710 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1711 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1712# endif
1713 char *yyfmt;
1714 char const *yyf;
1715 static char const yyunexpected[] = "syntax error, unexpected %s";
1716 static char const yyexpecting[] = ", expecting %s";
1717 static char const yyor[] = " or %s";
1718 char yyformat[sizeof yyunexpected
1719 + sizeof yyexpecting - 1
1720 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1721 * (sizeof yyor - 1))];
1722 char const *yyprefix = yyexpecting;
1723
1724 /* Start YYX at -YYN if negative to avoid negative indexes in
1725 YYCHECK. */
1726 int yyxbegin = yyn < 0 ? -yyn : 0;
1727
1728 /* Stay within bounds of both yycheck and yytname. */
1729 int yychecklim = YYLAST - yyn + 1;
1730 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1731 int yycount = 1;
1732
1733 yyarg[0] = yytname[yytype];
1734 yyfmt = yystpcpy (yyformat, yyunexpected);
1735
1736 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1737 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1738 {
1739 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1740 {
1741 yycount = 1;
1742 yysize = yysize0;
1743 yyformat[sizeof yyunexpected - 1] = '\0';
1744 break;
1745 }
1746 yyarg[yycount++] = yytname[yyx];
1747 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1748 yysize_overflow |= (yysize1 < yysize);
1749 yysize = yysize1;
1750 yyfmt = yystpcpy (yyfmt, yyprefix);
1751 yyprefix = yyor;
1752 }
1753
1754 yyf = YY_(yyformat);
1755 yysize1 = yysize + yystrlen (yyf);
1756 yysize_overflow |= (yysize1 < yysize);
1757 yysize = yysize1;
1758
1759 if (yysize_overflow)
1760 return YYSIZE_MAXIMUM;
1761
1762 if (yyresult)
1763 {
1764 /* Avoid sprintf, as that infringes on the user's name space.
1765 Don't have undefined behavior even if the translation
1766 produced a string with the wrong number of "%s"s. */
1767 char *yyp = yyresult;
1768 int yyi = 0;
1769 while ((*yyp = *yyf) != '\0')
1770 {
1771 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1772 {
1773 yyp += yytnamerr (yyp, yyarg[yyi++]);
1774 yyf += 2;
1775 }
1776 else
1777 {
1778 yyp++;
1779 yyf++;
1780 }
1781 }
1782 }
1783 return yysize;
1784 }
1785}
1786#endif /* YYERROR_VERBOSE */
1787
1788
1789/*-----------------------------------------------.
1790| Release the memory associated to this symbol. |
1791`-----------------------------------------------*/
1792
1793/*ARGSUSED*/
1794#if (defined __STDC__ || defined __C99__FUNC__ \
1795 || defined __cplusplus || defined _MSC_VER)
1796static void
1797yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1798#else
1799static void
1800yydestruct (yymsg, yytype, yyvaluep, context)
1801 const char *yymsg;
1802 int yytype;
1803 YYSTYPE *yyvaluep;
1804 TParseContext* context;
1805#endif
1806{
1807 YYUSE (yyvaluep);
1808 YYUSE (context);
1809
1810 if (!yymsg)
1811 yymsg = "Deleting";
1812 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1813
1814 switch (yytype)
1815 {
1816
1817 default:
1818 break;
1819 }
1820}
1821
1822
1823/* Prevent warnings from -Wmissing-prototypes. */
1824
1825#ifdef YYPARSE_PARAM
1826#if defined __STDC__ || defined __cplusplus
1827int yyparse (void *YYPARSE_PARAM);
1828#else
1829int yyparse ();
1830#endif
1831#else /* ! YYPARSE_PARAM */
1832#if defined __STDC__ || defined __cplusplus
1833int yyparse (TParseContext* context);
1834#else
1835int yyparse ();
1836#endif
1837#endif /* ! YYPARSE_PARAM */
1838
1839
1840
1841
1842
1843
1844/*----------.
1845| yyparse. |
1846`----------*/
1847
1848#ifdef YYPARSE_PARAM
1849#if (defined __STDC__ || defined __C99__FUNC__ \
1850 || defined __cplusplus || defined _MSC_VER)
1851int
1852yyparse (void *YYPARSE_PARAM)
1853#else
1854int
1855yyparse (YYPARSE_PARAM)
1856 void *YYPARSE_PARAM;
1857#endif
1858#else /* ! YYPARSE_PARAM */
1859#if (defined __STDC__ || defined __C99__FUNC__ \
1860 || defined __cplusplus || defined _MSC_VER)
1861int
1862yyparse (TParseContext* context)
1863#else
1864int
1865yyparse (context)
1866 TParseContext* context;
1867#endif
1868#endif
1869{
1870 /* The look-ahead symbol. */
1871int yychar;
1872
1873/* The semantic value of the look-ahead symbol. */
1874YYSTYPE yylval;
1875
1876/* Number of syntax errors so far. */
1877int yynerrs;
1878
1879 int yystate;
1880 int yyn;
1881 int yyresult;
1882 /* Number of tokens to shift before error messages enabled. */
1883 int yyerrstatus;
1884 /* Look-ahead token as an internal (translated) token number. */
1885 int yytoken = 0;
1886#if YYERROR_VERBOSE
1887 /* Buffer for error messages, and its allocated size. */
1888 char yymsgbuf[128];
1889 char *yymsg = yymsgbuf;
1890 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1891#endif
1892
1893 /* Three stacks and their tools:
1894 `yyss': related to states,
1895 `yyvs': related to semantic values,
1896 `yyls': related to locations.
1897
1898 Refer to the stacks thru separate pointers, to allow yyoverflow
1899 to reallocate them elsewhere. */
1900
1901 /* The state stack. */
1902 yytype_int16 yyssa[YYINITDEPTH];
1903 yytype_int16 *yyss = yyssa;
1904 yytype_int16 *yyssp;
1905
1906 /* The semantic value stack. */
1907 YYSTYPE yyvsa[YYINITDEPTH];
1908 YYSTYPE *yyvs = yyvsa;
1909 YYSTYPE *yyvsp;
1910
1911
1912
1913#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1914
1915 YYSIZE_T yystacksize = YYINITDEPTH;
1916
1917 /* The variables used to return semantic value and location from the
1918 action routines. */
1919 YYSTYPE yyval;
1920
1921
1922 /* The number of symbols on the RHS of the reduced rule.
1923 Keep to zero when no symbol should be popped. */
1924 int yylen = 0;
1925
1926 YYDPRINTF ((stderr, "Starting parse\n"));
1927
1928 yystate = 0;
1929 yyerrstatus = 0;
1930 yynerrs = 0;
1931 yychar = YYEMPTY; /* Cause a token to be read. */
1932
1933 /* Initialize stack pointers.
1934 Waste one element of value and location stack
1935 so that they stay on the same level as the state stack.
1936 The wasted elements are never initialized. */
1937
1938 yyssp = yyss;
1939 yyvsp = yyvs;
1940
1941 goto yysetstate;
1942
1943/*------------------------------------------------------------.
1944| yynewstate -- Push a new state, which is found in yystate. |
1945`------------------------------------------------------------*/
1946 yynewstate:
1947 /* In all cases, when you get here, the value and location stacks
1948 have just been pushed. So pushing a state here evens the stacks. */
1949 yyssp++;
1950
1951 yysetstate:
1952 *yyssp = yystate;
1953
1954 if (yyss + yystacksize - 1 <= yyssp)
1955 {
1956 /* Get the current used size of the three stacks, in elements. */
1957 YYSIZE_T yysize = yyssp - yyss + 1;
1958
1959#ifdef yyoverflow
1960 {
1961 /* Give user a chance to reallocate the stack. Use copies of
1962 these so that the &'s don't force the real ones into
1963 memory. */
1964 YYSTYPE *yyvs1 = yyvs;
1965 yytype_int16 *yyss1 = yyss;
1966
1967
1968 /* Each stack pointer address is followed by the size of the
1969 data in use in that stack, in bytes. This used to be a
1970 conditional around just the two extra args, but that might
1971 be undefined if yyoverflow is a macro. */
1972 yyoverflow (YY_("memory exhausted"),
1973 &yyss1, yysize * sizeof (*yyssp),
1974 &yyvs1, yysize * sizeof (*yyvsp),
1975
1976 &yystacksize);
1977
1978 yyss = yyss1;
1979 yyvs = yyvs1;
1980 }
1981#else /* no yyoverflow */
1982# ifndef YYSTACK_RELOCATE
1983 goto yyexhaustedlab;
1984# else
1985 /* Extend the stack our own way. */
1986 if (YYMAXDEPTH <= yystacksize)
1987 goto yyexhaustedlab;
1988 yystacksize *= 2;
1989 if (YYMAXDEPTH < yystacksize)
1990 yystacksize = YYMAXDEPTH;
1991
1992 {
1993 yytype_int16 *yyss1 = yyss;
1994 union yyalloc *yyptr =
1995 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1996 if (! yyptr)
1997 goto yyexhaustedlab;
1998 YYSTACK_RELOCATE (yyss);
1999 YYSTACK_RELOCATE (yyvs);
2000
2001# undef YYSTACK_RELOCATE
2002 if (yyss1 != yyssa)
2003 YYSTACK_FREE (yyss1);
2004 }
2005# endif
2006#endif /* no yyoverflow */
2007
2008 yyssp = yyss + yysize - 1;
2009 yyvsp = yyvs + yysize - 1;
2010
2011
2012 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2013 (unsigned long int) yystacksize));
2014
2015 if (yyss + yystacksize - 1 <= yyssp)
2016 YYABORT;
2017 }
2018
2019 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2020
2021 goto yybackup;
2022
2023/*-----------.
2024| yybackup. |
2025`-----------*/
2026yybackup:
2027
2028 /* Do appropriate processing given the current state. Read a
2029 look-ahead token if we need one and don't already have one. */
2030
2031 /* First try to decide what to do without reference to look-ahead token. */
2032 yyn = yypact[yystate];
2033 if (yyn == YYPACT_NINF)
2034 goto yydefault;
2035
2036 /* Not known => get a look-ahead token if don't already have one. */
2037
2038 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2039 if (yychar == YYEMPTY)
2040 {
2041 YYDPRINTF ((stderr, "Reading a token: "));
2042 yychar = YYLEX;
2043 }
2044
2045 if (yychar <= YYEOF)
2046 {
2047 yychar = yytoken = YYEOF;
2048 YYDPRINTF ((stderr, "Now at end of input.\n"));
2049 }
2050 else
2051 {
2052 yytoken = YYTRANSLATE (yychar);
2053 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2054 }
2055
2056 /* If the proper action on seeing token YYTOKEN is to reduce or to
2057 detect an error, take that action. */
2058 yyn += yytoken;
2059 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2060 goto yydefault;
2061 yyn = yytable[yyn];
2062 if (yyn <= 0)
2063 {
2064 if (yyn == 0 || yyn == YYTABLE_NINF)
2065 goto yyerrlab;
2066 yyn = -yyn;
2067 goto yyreduce;
2068 }
2069
2070 if (yyn == YYFINAL)
2071 YYACCEPT;
2072
2073 /* Count tokens shifted since error; after three, turn off error
2074 status. */
2075 if (yyerrstatus)
2076 yyerrstatus--;
2077
2078 /* Shift the look-ahead token. */
2079 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2080
2081 /* Discard the shifted token unless it is eof. */
2082 if (yychar != YYEOF)
2083 yychar = YYEMPTY;
2084
2085 yystate = yyn;
2086 *++yyvsp = yylval;
2087
2088 goto yynewstate;
2089
2090
2091/*-----------------------------------------------------------.
2092| yydefault -- do the default action for the current state. |
2093`-----------------------------------------------------------*/
2094yydefault:
2095 yyn = yydefact[yystate];
2096 if (yyn == 0)
2097 goto yyerrlab;
2098 goto yyreduce;
2099
2100
2101/*-----------------------------.
2102| yyreduce -- Do a reduction. |
2103`-----------------------------*/
2104yyreduce:
2105 /* yyn is the number of a rule to reduce with. */
2106 yylen = yyr2[yyn];
2107
2108 /* If YYLEN is nonzero, implement the default value of the action:
2109 `$$ = $1'.
2110
2111 Otherwise, the following line sets YYVAL to garbage.
2112 This behavior is undocumented and Bison
2113 users should not rely upon it. Assigning to YYVAL
2114 unconditionally makes the parser a bit smaller, and it avoids a
2115 GCC warning that YYVAL may be used uninitialized. */
2116 yyval = yyvsp[1-yylen];
2117
2118
2119 YY_REDUCE_PRINT (yyn);
2120 switch (yyn)
2121 {
2122 case 2:
2123
2124 {
2125 // The symbol table search was done in the lexical phase
2126 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2127 const TVariable* variable;
2128 if (symbol == 0) {
2129 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2130 context->recover();
2131 TType type(EbtFloat, EbpUndefined);
2132 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2133 context->symbolTable.insert(*fakeVariable);
2134 variable = fakeVariable;
2135 } else {
2136 // This identifier can only be a variable type symbol
2137 if (! symbol->isVariable()) {
2138 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2139 context->recover();
2140 }
2141 variable = static_cast<const TVariable*>(symbol);
2142 }
2143
2144 // don't delete $1.string, it's used by error recovery, and the pool
2145 // pop will reclaim the memory
2146
2147 if (variable->getType().getQualifier() == EvqConst ) {
2148 ConstantUnion* constArray = variable->getConstPointer();
2149 TType t(variable->getType());
2150 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2151 } else
2152 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2153 variable->getName(),
2154 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2155 ;}
2156 break;
2157
2158 case 3:
2159
2160 {
2161 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2162 ;}
2163 break;
2164
2165 case 4:
2166
2167 {
2168 //
2169 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2170 // check for overflow for constants
2171 //
2172 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2173 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2174 context->recover();
2175 }
2176 ConstantUnion *unionArray = new ConstantUnion[1];
2177 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2178 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2179 ;}
2180 break;
2181
2182 case 5:
2183
2184 {
2185 ConstantUnion *unionArray = new ConstantUnion[1];
2186 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2187 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2188 ;}
2189 break;
2190
2191 case 6:
2192
2193 {
2194 ConstantUnion *unionArray = new ConstantUnion[1];
2195 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2196 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2197 ;}
2198 break;
2199
2200 case 7:
2201
2202 {
2203 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2204 ;}
2205 break;
2206
2207 case 8:
2208
2209 {
2210 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2211 ;}
2212 break;
2213
2214 case 9:
2215
2216 {
2217 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2218 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2219 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(), "");
2220 else
2221 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2222 context->recover();
2223 }
2224 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2225 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2226 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2227 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2228 TVectorFields fields;
2229 fields.num = 1;
2230 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2231 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2232 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2233 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2234 }
2235 } else {
2236 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2237 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() ) {
2238 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2239 context->recover();
2240 } else {
2241 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2242 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2243 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2244 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))
2245 context->recover();
2246 } else {
2247 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2248 context->recover();
2249 }
2250 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2251 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2252 context->recover();
2253 }
2254 }
2255 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2256 }
2257 } else {
2258 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2259 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2260 context->recover();
2261 }
2262
2263 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2264 }
2265 }
2266 if ((yyval.interm.intermTypedNode) == 0) {
2267 ConstantUnion *unionArray = new ConstantUnion[1];
2268 unionArray->setFConst(0.0f);
2269 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2270 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2271 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2272 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2273 else
2274 (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()));
2275
2276 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2277 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2278 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2279 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2280 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2281 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2282 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2283 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2284 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2285 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2286 else
2287 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2288 ;}
2289 break;
2290
2291 case 10:
2292
2293 {
2294 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2295 ;}
2296 break;
2297
2298 case 11:
2299
2300 {
2301 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2302 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2303 context->recover();
2304 }
2305
2306 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2307 TVectorFields fields;
2308 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2309 fields.num = 1;
2310 fields.offsets[0] = 0;
2311 context->recover();
2312 }
2313
2314 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2315 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2316 if ((yyval.interm.intermTypedNode) == 0) {
2317 context->recover();
2318 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2319 }
2320 else
2321 (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()));
2322 } else {
2323 if (fields.num == 1) {
2324 ConstantUnion *unionArray = new ConstantUnion[1];
2325 unionArray->setIConst(fields.offsets[0]);
2326 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2327 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2328 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2329 } else {
2330 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2331 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2332 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2333 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2334 }
2335 }
2336 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2337 TMatrixFields fields;
2338 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2339 fields.wholeRow = false;
2340 fields.wholeCol = false;
2341 fields.row = 0;
2342 fields.col = 0;
2343 context->recover();
2344 }
2345
2346 if (fields.wholeRow || fields.wholeCol) {
2347 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2348 context->recover();
2349 ConstantUnion *unionArray = new ConstantUnion[1];
2350 unionArray->setIConst(0);
2351 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2352 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2353 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2354 } else {
2355 ConstantUnion *unionArray = new ConstantUnion[1];
2356 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2357 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2358 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2359 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2360 }
2361 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2362 bool fieldFound = false;
2363 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2364 if (fields == 0) {
2365 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2366 context->recover();
2367 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2368 } else {
2369 unsigned int i;
2370 for (i = 0; i < fields->size(); ++i) {
2371 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2372 fieldFound = true;
2373 break;
2374 }
2375 }
2376 if (fieldFound) {
2377 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2378 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2379 if ((yyval.interm.intermTypedNode) == 0) {
2380 context->recover();
2381 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2382 }
2383 else {
2384 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2385 // change the qualifier of the return type, not of the structure field
2386 // as the structure definition is shared between various structures.
2387 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2388 }
2389 } else {
2390 ConstantUnion *unionArray = new ConstantUnion[1];
2391 unionArray->setIConst(i);
2392 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2393 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2394 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2395 }
2396 } else {
2397 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2398 context->recover();
2399 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2400 }
2401 }
2402 } else {
2403 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(), "");
2404 context->recover();
2405 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2406 }
2407 // don't delete $3.string, it's from the pool
2408 ;}
2409 break;
2410
2411 case 12:
2412
2413 {
2414 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2415 context->recover();
2416 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2417 if ((yyval.interm.intermTypedNode) == 0) {
2418 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2419 context->recover();
2420 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2421 }
2422 ;}
2423 break;
2424
2425 case 13:
2426
2427 {
2428 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2429 context->recover();
2430 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2431 if ((yyval.interm.intermTypedNode) == 0) {
2432 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2433 context->recover();
2434 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2435 }
2436 ;}
2437 break;
2438
2439 case 14:
2440
2441 {
2442 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2443 context->recover();
2444 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2445 ;}
2446 break;
2447
2448 case 15:
2449
2450 {
2451 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2452 TOperator op = fnCall->getBuiltInOp();
2453
2454 if (op != EOpNull)
2455 {
2456 //
2457 // Then this should be a constructor.
2458 // Don't go through the symbol table for constructors.
2459 // Their parameters will be verified algorithmically.
2460 //
2461 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2462 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2463 (yyval.interm.intermTypedNode) = 0;
2464 } else {
2465 //
2466 // It's a constructor, of type 'type'.
2467 //
2468 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2469 }
2470
2471 if ((yyval.interm.intermTypedNode) == 0) {
2472 context->recover();
2473 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2474 }
2475 (yyval.interm.intermTypedNode)->setType(type);
2476 } else {
2477 //
2478 // Not a constructor. Find it in the symbol table.
2479 //
2480 const TFunction* fnCandidate;
2481 bool builtIn;
2482 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2483 if (fnCandidate) {
2484 //
2485 // A declared function.
2486 //
2487 if (builtIn && !fnCandidate->getExtension().empty() &&
2488 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2489 context->recover();
2490 }
2491 op = fnCandidate->getBuiltInOp();
2492 if (builtIn && op != EOpNull) {
2493 //
2494 // A function call mapped to a built-in operation.
2495 //
2496 if (fnCandidate->getParamCount() == 1) {
2497 //
2498 // Treat it like a built-in unary operator.
2499 //
2500 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2501 if ((yyval.interm.intermTypedNode) == 0) {
2502 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2503 "built in unary operator function. Type: %s",
2504 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2505 YYERROR;
2506 }
2507 } else {
2508 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2509 }
2510 } else {
2511 // This is a real function call
2512
2513 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2514 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2515
2516 // this is how we know whether the given function is a builtIn function or a user defined function
2517 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2518 // if builtIn == true, it's definitely a builtIn function with EOpNull
2519 if (!builtIn)
2520 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2521 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2522
2523 TQualifier qual;
2524 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2525 qual = fnCandidate->getParam(i).type->getQualifier();
2526 if (qual == EvqOut || qual == EvqInOut) {
2527 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2528 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2529 context->recover();
2530 }
2531 }
2532 }
2533 }
2534 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2535 } else {
2536 // error message was put out by PaFindFunction()
2537 // Put on a dummy node for error recovery
2538 ConstantUnion *unionArray = new ConstantUnion[1];
2539 unionArray->setFConst(0.0f);
2540 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2541 context->recover();
2542 }
2543 }
2544 delete fnCall;
2545 ;}
2546 break;
2547
2548 case 16:
2549
2550 {
2551 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2552 ;}
2553 break;
2554
2555 case 17:
2556
2557 {
2558 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2559 context->recover();
2560 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2561 ;}
2562 break;
2563
2564 case 18:
2565
2566 {
2567 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2568 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2569 ;}
2570 break;
2571
2572 case 19:
2573
2574 {
2575 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2576 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2577 ;}
2578 break;
2579
2580 case 20:
2581
2582 {
2583 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2584 (yyval.interm).intermNode = 0;
2585 ;}
2586 break;
2587
2588 case 21:
2589
2590 {
2591 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2592 (yyval.interm).intermNode = 0;
2593 ;}
2594 break;
2595
2596 case 22:
2597
2598 {
2599 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2600 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2601 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2602 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2603 ;}
2604 break;
2605
2606 case 23:
2607
2608 {
2609 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2610 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2611 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2612 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2613 ;}
2614 break;
2615
2616 case 24:
2617
2618 {
2619 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2620 ;}
2621 break;
2622
2623 case 25:
2624
2625 {
2626 //
2627 // Constructor
2628 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002629 TOperator op = EOpNull;
2630 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2631 op = EOpConstructStruct;
2632 } else {
2633 switch ((yyvsp[(1) - (1)].interm.type).type) {
2634 case EbtFloat:
2635 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2636 switch((yyvsp[(1) - (1)].interm.type).size) {
2637 case 2: op = EOpConstructMat2; break;
2638 case 3: op = EOpConstructMat3; break;
2639 case 4: op = EOpConstructMat4; break;
2640 }
2641 } else {
2642 switch((yyvsp[(1) - (1)].interm.type).size) {
2643 case 1: op = EOpConstructFloat; break;
2644 case 2: op = EOpConstructVec2; break;
2645 case 3: op = EOpConstructVec3; break;
2646 case 4: op = EOpConstructVec4; break;
2647 }
2648 }
2649 break;
2650 case EbtInt:
2651 switch((yyvsp[(1) - (1)].interm.type).size) {
2652 case 1: op = EOpConstructInt; break;
2653 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2654 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2655 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2656 }
2657 break;
2658 case EbtBool:
2659 switch((yyvsp[(1) - (1)].interm.type).size) {
2660 case 1: op = EOpConstructBool; break;
2661 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2662 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2663 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2664 }
2665 break;
2666 default: break;
2667 }
2668 if (op == EOpNull) {
2669 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2670 context->recover();
2671 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2672 op = EOpConstructFloat;
2673 }
2674 }
2675 TString tempString;
2676 TType type((yyvsp[(1) - (1)].interm.type));
2677 TFunction *function = new TFunction(&tempString, type, op);
2678 (yyval.interm.function) = function;
2679 ;}
2680 break;
2681
2682 case 26:
2683
2684 {
2685 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2686 context->recover();
2687 TType type(EbtVoid, EbpUndefined);
2688 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2689 (yyval.interm.function) = function;
2690 ;}
2691 break;
2692
2693 case 27:
2694
2695 {
2696 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2697 context->recover();
2698 TType type(EbtVoid, EbpUndefined);
2699 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2700 (yyval.interm.function) = function;
2701 ;}
2702 break;
2703
2704 case 28:
2705
2706 {
2707 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2708 ;}
2709 break;
2710
2711 case 29:
2712
2713 {
2714 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2715 context->recover();
2716 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2717 if ((yyval.interm.intermTypedNode) == 0) {
2718 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2719 context->recover();
2720 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2721 }
2722 ;}
2723 break;
2724
2725 case 30:
2726
2727 {
2728 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2729 context->recover();
2730 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2731 if ((yyval.interm.intermTypedNode) == 0) {
2732 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2733 context->recover();
2734 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2735 }
2736 ;}
2737 break;
2738
2739 case 31:
2740
2741 {
2742 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2743 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2744 if ((yyval.interm.intermTypedNode) == 0) {
2745 const char* errorOp = "";
2746 switch((yyvsp[(1) - (2)].interm).op) {
2747 case EOpNegative: errorOp = "-"; break;
2748 case EOpLogicalNot: errorOp = "!"; break;
2749 default: break;
2750 }
2751 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2752 context->recover();
2753 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2754 }
2755 } else
2756 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2757 ;}
2758 break;
2759
2760 case 32:
2761
2762 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
2763 break;
2764
2765 case 33:
2766
2767 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
2768 break;
2769
2770 case 34:
2771
2772 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
2773 break;
2774
2775 case 35:
2776
2777 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2778 break;
2779
2780 case 36:
2781
2782 {
2783 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2784 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2785 if ((yyval.interm.intermTypedNode) == 0) {
2786 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2787 context->recover();
2788 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2789 }
2790 ;}
2791 break;
2792
2793 case 37:
2794
2795 {
2796 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2797 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2798 if ((yyval.interm.intermTypedNode) == 0) {
2799 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2800 context->recover();
2801 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2802 }
2803 ;}
2804 break;
2805
2806 case 38:
2807
2808 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2809 break;
2810
2811 case 39:
2812
2813 {
2814 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (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 40:
2824
2825 {
2826 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2827 if ((yyval.interm.intermTypedNode) == 0) {
2828 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2829 context->recover();
2830 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2831 }
2832 ;}
2833 break;
2834
2835 case 41:
2836
2837 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2838 break;
2839
2840 case 42:
2841
2842 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2843 break;
2844
2845 case 43:
2846
2847 {
2848 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2849 if ((yyval.interm.intermTypedNode) == 0) {
2850 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2851 context->recover();
2852 ConstantUnion *unionArray = new ConstantUnion[1];
2853 unionArray->setBConst(false);
2854 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2855 }
2856 ;}
2857 break;
2858
2859 case 44:
2860
2861 {
2862 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2863 if ((yyval.interm.intermTypedNode) == 0) {
2864 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2865 context->recover();
2866 ConstantUnion *unionArray = new ConstantUnion[1];
2867 unionArray->setBConst(false);
2868 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2869 }
2870 ;}
2871 break;
2872
2873 case 45:
2874
2875 {
2876 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2877 if ((yyval.interm.intermTypedNode) == 0) {
2878 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2879 context->recover();
2880 ConstantUnion *unionArray = new ConstantUnion[1];
2881 unionArray->setBConst(false);
2882 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2883 }
2884 ;}
2885 break;
2886
2887 case 46:
2888
2889 {
2890 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2891 if ((yyval.interm.intermTypedNode) == 0) {
2892 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2893 context->recover();
2894 ConstantUnion *unionArray = new ConstantUnion[1];
2895 unionArray->setBConst(false);
2896 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2897 }
2898 ;}
2899 break;
2900
2901 case 47:
2902
2903 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2904 break;
2905
2906 case 48:
2907
2908 {
2909 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2910 if ((yyval.interm.intermTypedNode) == 0) {
2911 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2912 context->recover();
2913 ConstantUnion *unionArray = new ConstantUnion[1];
2914 unionArray->setBConst(false);
2915 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2916 }
2917 ;}
2918 break;
2919
2920 case 49:
2921
2922 {
2923 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2924 if ((yyval.interm.intermTypedNode) == 0) {
2925 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2926 context->recover();
2927 ConstantUnion *unionArray = new ConstantUnion[1];
2928 unionArray->setBConst(false);
2929 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2930 }
2931 ;}
2932 break;
2933
2934 case 50:
2935
2936 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2937 break;
2938
2939 case 51:
2940
2941 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2942 break;
2943
2944 case 52:
2945
2946 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2947 break;
2948
2949 case 53:
2950
2951 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2952 break;
2953
2954 case 54:
2955
2956 {
2957 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2958 if ((yyval.interm.intermTypedNode) == 0) {
2959 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2960 context->recover();
2961 ConstantUnion *unionArray = new ConstantUnion[1];
2962 unionArray->setBConst(false);
2963 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2964 }
2965 ;}
2966 break;
2967
2968 case 55:
2969
2970 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2971 break;
2972
2973 case 56:
2974
2975 {
2976 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2977 if ((yyval.interm.intermTypedNode) == 0) {
2978 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2979 context->recover();
2980 ConstantUnion *unionArray = new ConstantUnion[1];
2981 unionArray->setBConst(false);
2982 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2983 }
2984 ;}
2985 break;
2986
2987 case 57:
2988
2989 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2990 break;
2991
2992 case 58:
2993
2994 {
2995 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2996 if ((yyval.interm.intermTypedNode) == 0) {
2997 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2998 context->recover();
2999 ConstantUnion *unionArray = new ConstantUnion[1];
3000 unionArray->setBConst(false);
3001 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
3002 }
3003 ;}
3004 break;
3005
3006 case 59:
3007
3008 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
3009 break;
3010
3011 case 60:
3012
3013 {
3014 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3015 context->recover();
3016
3017 (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);
3018 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3019 (yyval.interm.intermTypedNode) = 0;
3020
3021 if ((yyval.interm.intermTypedNode) == 0) {
3022 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3023 context->recover();
3024 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3025 }
3026 ;}
3027 break;
3028
3029 case 61:
3030
3031 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
3032 break;
3033
3034 case 62:
3035
3036 {
3037 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3038 context->recover();
3039 (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);
3040 if ((yyval.interm.intermTypedNode) == 0) {
3041 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3042 context->recover();
3043 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3044 }
3045 ;}
3046 break;
3047
3048 case 63:
3049
3050 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
3051 break;
3052
3053 case 64:
3054
3055 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;}
3056 break;
3057
3058 case 65:
3059
3060 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; ;}
3061 break;
3062
3063 case 66:
3064
3065 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
3066 break;
3067
3068 case 67:
3069
3070 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
3071 break;
3072
3073 case 68:
3074
3075 {
3076 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3077 ;}
3078 break;
3079
3080 case 69:
3081
3082 {
3083 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3084 if ((yyval.interm.intermTypedNode) == 0) {
3085 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3086 context->recover();
3087 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3088 }
3089 ;}
3090 break;
3091
3092 case 70:
3093
3094 {
3095 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3096 context->recover();
3097 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3098 ;}
3099 break;
3100
3101 case 71:
3102
3103 {
3104 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3105
3106 TIntermAggregate *prototype = new TIntermAggregate;
3107 prototype->setType(function.getReturnType());
3108 prototype->setName(function.getName());
3109
3110 for (int i = 0; i < function.getParamCount(); i++)
3111 {
3112 const TParameter &param = function.getParam(i);
3113 if (param.name != 0)
3114 {
3115 TVariable *variable = new TVariable(param.name, *param.type);
3116
3117 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3118 }
3119 else
3120 {
3121 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3122 }
3123 }
3124
3125 prototype->setOp(EOpPrototype);
3126 (yyval.interm.intermNode) = prototype;
3127 ;}
3128 break;
3129
3130 case 72:
3131
3132 {
3133 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3134 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3135 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3136 ;}
3137 break;
3138
3139 case 73:
3140
3141 {
3142 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3143 (yyval.interm.intermNode) = 0;
3144 ;}
3145 break;
3146
3147 case 74:
3148
3149 {
3150 //
3151 // Multiple declarations of the same function are allowed.
3152 //
3153 // If this is a definition, the definition production code will check for redefinitions
3154 // (we don't know at this point if it's a definition or not).
3155 //
3156 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3157 //
3158 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3159 if (prevDec) {
3160 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3161 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3162 context->recover();
3163 }
3164 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3165 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3166 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3167 context->recover();
3168 }
3169 }
3170 }
3171
3172 //
3173 // If this is a redeclaration, it could also be a definition,
3174 // in which case, we want to use the variable names from this one, and not the one that's
3175 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3176 //
3177 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3178 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3179
3180 context->symbolTable.insert(*(yyval.interm).function);
3181 ;}
3182 break;
3183
3184 case 75:
3185
3186 {
3187 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3188 ;}
3189 break;
3190
3191 case 76:
3192
3193 {
3194 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3195 ;}
3196 break;
3197
3198 case 77:
3199
3200 {
3201 // Add the parameter
3202 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3203 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3204 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3205 else
3206 delete (yyvsp[(2) - (2)].interm).param.type;
3207 ;}
3208 break;
3209
3210 case 78:
3211
3212 {
3213 //
3214 // Only first parameter of one-parameter functions can be void
3215 // The check for named parameters not being void is done in parameter_declarator
3216 //
3217 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3218 //
3219 // This parameter > first is void
3220 //
3221 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3222 context->recover();
3223 delete (yyvsp[(3) - (3)].interm).param.type;
3224 } else {
3225 // Add the parameter
3226 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3227 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3228 }
3229 ;}
3230 break;
3231
3232 case 79:
3233
3234 {
3235 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3236 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3237 context->recover();
3238 }
3239 // make sure a sampler is not involved as well...
3240 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3241 context->recover();
3242
3243 // Add the function as a prototype after parsing it (we do not support recursion)
3244 TFunction *function;
3245 TType type((yyvsp[(1) - (3)].interm.type));
3246 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3247 (yyval.interm.function) = function;
3248 ;}
3249 break;
3250
3251 case 80:
3252
3253 {
3254 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3255 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3256 context->recover();
3257 }
3258 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3259 context->recover();
3260 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3261 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3262 (yyval.interm).param = param;
3263 ;}
3264 break;
3265
3266 case 81:
3267
3268 {
3269 // Check that we can make an array out of this type
3270 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3271 context->recover();
3272
3273 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3274 context->recover();
3275
3276 int size;
3277 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3278 context->recover();
3279 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3280
3281 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3282 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3283 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3284 (yyval.interm).param = param;
3285 ;}
3286 break;
3287
3288 case 82:
3289
3290 {
3291 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3292 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3293 context->recover();
3294 ;}
3295 break;
3296
3297 case 83:
3298
3299 {
3300 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3301 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3302 context->recover();
3303 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3304 context->recover();
3305 ;}
3306 break;
3307
3308 case 84:
3309
3310 {
3311 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3312 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3313 context->recover();
3314 ;}
3315 break;
3316
3317 case 85:
3318
3319 {
3320 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3321 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3322 context->recover();
3323 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3324 context->recover();
3325 ;}
3326 break;
3327
3328 case 86:
3329
3330 {
3331 (yyval.interm.qualifier) = EvqIn;
3332 ;}
3333 break;
3334
3335 case 87:
3336
3337 {
3338 (yyval.interm.qualifier) = EvqIn;
3339 ;}
3340 break;
3341
3342 case 88:
3343
3344 {
3345 (yyval.interm.qualifier) = EvqOut;
3346 ;}
3347 break;
3348
3349 case 89:
3350
3351 {
3352 (yyval.interm.qualifier) = EvqInOut;
3353 ;}
3354 break;
3355
3356 case 90:
3357
3358 {
3359 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3360 (yyval.interm).param = param;
3361 ;}
3362 break;
3363
3364 case 91:
3365
3366 {
3367 (yyval.interm) = (yyvsp[(1) - (1)].interm);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003368 ;}
3369 break;
3370
3371 case 92:
3372
3373 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003374 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3375 (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 +00003376
3377 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3378 context->recover();
3379
3380 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3381 context->recover();
3382
zmo@google.comfd747b82011-04-23 01:30:07 +00003383 TVariable* variable = 0;
3384 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 +00003385 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003386 if (symbol && variable)
3387 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003388 ;}
3389 break;
3390
3391 case 93:
3392
3393 {
3394 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3395 context->recover();
3396
3397 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3398 context->recover();
3399
3400 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3401
3402 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))
3403 context->recover();
3404 else {
3405 (yyvsp[(1) - (5)].interm).type.setArray(true);
3406 TVariable* variable;
3407 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3408 context->recover();
3409 }
3410 ;}
3411 break;
3412
3413 case 94:
3414
3415 {
3416 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3417 context->recover();
3418
3419 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3420 context->recover();
3421
3422 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3423
3424 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))
3425 context->recover();
3426 else {
3427 int size;
3428 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3429 context->recover();
3430 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003431 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003432 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3433 context->recover();
3434 TType type = TType((yyvsp[(1) - (6)].interm).type);
3435 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003436 (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 +00003437 }
3438 ;}
3439 break;
3440
3441 case 95:
3442
3443 {
3444 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3445 context->recover();
3446
3447 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3448
3449 TIntermNode* intermNode;
3450 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3451 //
3452 // build the intermediate representation
3453 //
3454 if (intermNode)
3455 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3456 else
3457 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3458 } else {
3459 context->recover();
3460 (yyval.interm).intermAggregate = 0;
3461 }
3462 ;}
3463 break;
3464
3465 case 96:
3466
3467 {
3468 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3469 (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);
3470 ;}
3471 break;
3472
3473 case 97:
3474
3475 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003476 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3477 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003478
3479 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3480 context->recover();
3481
3482 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3483 context->recover();
3484
3485 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3486
zmo@google.comfd747b82011-04-23 01:30:07 +00003487 TVariable* variable = 0;
3488 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 +00003489 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003490 if (variable && symbol)
3491 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003492 ;}
3493 break;
3494
3495 case 98:
3496
3497 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003498 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3499 context->recover();
3500
zmo@google.comfd747b82011-04-23 01:30:07 +00003501 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3502 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003503 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003504 ;}
3505 break;
3506
3507 case 99:
3508
3509 {
3510 TType type = TType((yyvsp[(1) - (5)].interm.type));
3511 int size;
3512 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3513 context->recover();
3514 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003515 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3516 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003517
3518 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3519 context->recover();
3520
3521 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3522 context->recover();
3523
3524 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3525
3526 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)))
3527 context->recover();
3528 else {
3529 int size;
3530 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3531 context->recover();
3532
3533 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003534 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003535 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3536 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003537 if (variable && symbol)
3538 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003539 }
3540 ;}
3541 break;
3542
3543 case 100:
3544
3545 {
3546 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3547 context->recover();
3548
3549 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3550
3551 TIntermNode* intermNode;
3552 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3553 //
3554 // Build intermediate representation
3555 //
3556 if(intermNode)
3557 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3558 else
3559 (yyval.interm).intermAggregate = 0;
3560 } else {
3561 context->recover();
3562 (yyval.interm).intermAggregate = 0;
3563 }
3564 ;}
3565 break;
3566
3567 case 101:
3568
3569 {
3570 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3571 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3572 (yyval.interm).intermAggregate = 0;
3573 ;}
3574 break;
3575
3576 case 102:
3577
3578 {
3579 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3580
3581 if ((yyvsp[(1) - (1)].interm.type).array) {
3582 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3583 context->recover();
3584 (yyvsp[(1) - (1)].interm.type).setArray(false);
3585 }
3586 ;}
3587 break;
3588
3589 case 103:
3590
3591 {
3592 if ((yyvsp[(2) - (2)].interm.type).array) {
3593 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3594 context->recover();
3595 (yyvsp[(2) - (2)].interm.type).setArray(false);
3596 }
3597
3598 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3599 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3600 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3601 context->recover();
3602 }
3603 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3604 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3605 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3606 context->recover();
3607 }
3608 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3609 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3610 ;}
3611 break;
3612
3613 case 104:
3614
3615 {
3616 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
3617 ;}
3618 break;
3619
3620 case 105:
3621
3622 {
3623 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3624 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3625 context->recover();
3626 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3627 ;}
3628 break;
3629
3630 case 106:
3631
3632 {
3633 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3634 context->recover();
3635 if (context->shaderType == SH_VERTEX_SHADER)
3636 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3637 else
3638 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3639 ;}
3640 break;
3641
3642 case 107:
3643
3644 {
3645 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3646 context->recover();
3647 if (context->shaderType == SH_VERTEX_SHADER)
3648 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3649 else
3650 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3651 ;}
3652 break;
3653
3654 case 108:
3655
3656 {
3657 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3658 context->recover();
3659 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
3660 ;}
3661 break;
3662
3663 case 109:
3664
3665 {
3666 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003667
3668 if ((yyval.interm.type).precision == EbpUndefined) {
3669 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3670 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3671 context->recover();
3672 }
3673 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003674 ;}
3675 break;
3676
3677 case 110:
3678
3679 {
3680 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3681 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3682 ;}
3683 break;
3684
3685 case 111:
3686
3687 {
3688 (yyval.interm.precision) = EbpHigh;
3689 ;}
3690 break;
3691
3692 case 112:
3693
3694 {
3695 (yyval.interm.precision) = EbpMedium;
3696 ;}
3697 break;
3698
3699 case 113:
3700
3701 {
3702 (yyval.interm.precision) = EbpLow;
3703 ;}
3704 break;
3705
3706 case 114:
3707
3708 {
3709 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3710 ;}
3711 break;
3712
3713 case 115:
3714
3715 {
3716 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3717
3718 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3719 context->recover();
3720 else {
3721 int size;
3722 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3723 context->recover();
3724 (yyval.interm.type).setArray(true, size);
3725 }
3726 ;}
3727 break;
3728
3729 case 116:
3730
3731 {
3732 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3733 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
3734 ;}
3735 break;
3736
3737 case 117:
3738
3739 {
3740 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3741 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3742 ;}
3743 break;
3744
3745 case 118:
3746
3747 {
3748 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3749 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3750 ;}
3751 break;
3752
3753 case 119:
3754
3755 {
3756 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3757 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3758 ;}
3759 break;
3760
3761 case 120:
3762
3763 {
3764 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3765 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3766 (yyval.interm.type).setAggregate(2);
3767 ;}
3768 break;
3769
3770 case 121:
3771
3772 {
3773 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3774 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3775 (yyval.interm.type).setAggregate(3);
3776 ;}
3777 break;
3778
3779 case 122:
3780
3781 {
3782 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3783 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3784 (yyval.interm.type).setAggregate(4);
3785 ;}
3786 break;
3787
3788 case 123:
3789
3790 {
3791 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3792 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3793 (yyval.interm.type).setAggregate(2);
3794 ;}
3795 break;
3796
3797 case 124:
3798
3799 {
3800 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3801 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3802 (yyval.interm.type).setAggregate(3);
3803 ;}
3804 break;
3805
3806 case 125:
3807
3808 {
3809 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3810 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3811 (yyval.interm.type).setAggregate(4);
3812 ;}
3813 break;
3814
3815 case 126:
3816
3817 {
3818 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3819 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3820 (yyval.interm.type).setAggregate(2);
3821 ;}
3822 break;
3823
3824 case 127:
3825
3826 {
3827 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3828 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3829 (yyval.interm.type).setAggregate(3);
3830 ;}
3831 break;
3832
3833 case 128:
3834
3835 {
3836 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3837 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3838 (yyval.interm.type).setAggregate(4);
3839 ;}
3840 break;
3841
3842 case 129:
3843
3844 {
3845 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3846 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3847 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3848 (yyval.interm.type).setAggregate(2, true);
3849 ;}
3850 break;
3851
3852 case 130:
3853
3854 {
3855 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3856 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3857 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3858 (yyval.interm.type).setAggregate(3, true);
3859 ;}
3860 break;
3861
3862 case 131:
3863
3864 {
3865 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3866 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3867 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3868 (yyval.interm.type).setAggregate(4, true);
3869 ;}
3870 break;
3871
3872 case 132:
3873
3874 {
3875 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3876 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3877 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
3878 ;}
3879 break;
3880
3881 case 133:
3882
3883 {
3884 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3885 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3886 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
3887 ;}
3888 break;
3889
3890 case 134:
3891
3892 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003893 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3894 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3895 context->recover();
3896 }
3897 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3898 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3899 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
3900 ;}
3901 break;
3902
3903 case 135:
3904
3905 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003906 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3907 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3908 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3909 ;}
3910 break;
3911
zmo@google.com09c323a2011-08-12 18:22:25 +00003912 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003913
3914 {
3915 //
3916 // This is for user defined type names. The lexical phase looked up the
3917 // type.
3918 //
3919 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3920 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3921 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3922 (yyval.interm.type).userDef = &structure;
3923 ;}
3924 break;
3925
zmo@google.com09c323a2011-08-12 18:22:25 +00003926 case 137:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003927
3928 {
3929 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3930 context->recover();
3931
3932 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), *(yyvsp[(2) - (5)].lex).string);
3933 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (5)].lex).string, *structure, true);
3934 if (! context->symbolTable.insert(*userTypeDef)) {
3935 context->error((yyvsp[(2) - (5)].lex).line, "redefinition", (yyvsp[(2) - (5)].lex).string->c_str(), "struct");
3936 context->recover();
3937 }
3938 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3939 (yyval.interm.type).userDef = structure;
3940 ;}
3941 break;
3942
zmo@google.com09c323a2011-08-12 18:22:25 +00003943 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003944
3945 {
3946 TType* structure = new TType((yyvsp[(3) - (4)].interm.typeList), TString(""));
3947 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (4)].lex).line);
3948 (yyval.interm.type).userDef = structure;
3949 ;}
3950 break;
3951
zmo@google.com09c323a2011-08-12 18:22:25 +00003952 case 139:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003953
3954 {
3955 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
3956 ;}
3957 break;
3958
zmo@google.com09c323a2011-08-12 18:22:25 +00003959 case 140:
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
zmo@google.com09c323a2011-08-12 18:22:25 +00003975 case 141:
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 }
4004 }
4005 ;}
4006 break;
4007
zmo@google.com09c323a2011-08-12 18:22:25 +00004008 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004009
4010 {
4011 (yyval.interm.typeList) = NewPoolTTypeList();
4012 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4013 ;}
4014 break;
4015
zmo@google.com09c323a2011-08-12 18:22:25 +00004016 case 143:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004017
4018 {
4019 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4020 ;}
4021 break;
4022
zmo@google.com09c323a2011-08-12 18:22:25 +00004023 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004024
4025 {
4026 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4027 context->recover();
4028
4029 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4030 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4031 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4032 ;}
4033 break;
4034
zmo@google.com09c323a2011-08-12 18:22:25 +00004035 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004036
4037 {
4038 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4039 context->recover();
4040
4041 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4042 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4043 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4044
4045 int size;
4046 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4047 context->recover();
4048 (yyval.interm.typeLine).type->setArraySize(size);
4049 ;}
4050 break;
4051
zmo@google.com09c323a2011-08-12 18:22:25 +00004052 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004053
4054 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
4055 break;
4056
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004057 case 147:
4058
zmo@google.com09c323a2011-08-12 18:22:25 +00004059 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004060 break;
4061
4062 case 148:
4063
zmo@google.com09c323a2011-08-12 18:22:25 +00004064 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004065 break;
4066
4067 case 149:
4068
4069 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4070 break;
4071
4072 case 150:
4073
4074 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4075 break;
4076
4077 case 151:
4078
4079 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4080 break;
4081
4082 case 152:
4083
4084 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4085 break;
4086
4087 case 153:
4088
4089 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4090 break;
4091
4092 case 154:
4093
zmo@google.com09c323a2011-08-12 18:22:25 +00004094 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004095 break;
4096
4097 case 155:
4098
zmo@google.com09c323a2011-08-12 18:22:25 +00004099 { (yyval.interm.intermAggregate) = 0; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004100 break;
4101
4102 case 156:
4103
zmo@google.com09c323a2011-08-12 18:22:25 +00004104 { context->symbolTable.push(); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004105 break;
4106
4107 case 157:
4108
zmo@google.com09c323a2011-08-12 18:22:25 +00004109 { context->symbolTable.pop(); ;}
4110 break;
4111
4112 case 158:
4113
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004114 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004115 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004116 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004117 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4118 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004119 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4120 ;}
4121 break;
4122
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004123 case 159:
4124
4125 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4126 break;
4127
4128 case 160:
4129
zmo@google.com09c323a2011-08-12 18:22:25 +00004130 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4131 break;
4132
4133 case 161:
4134
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004135 {
4136 (yyval.interm.intermNode) = 0;
4137 ;}
4138 break;
4139
zmo@google.com09c323a2011-08-12 18:22:25 +00004140 case 162:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004141
4142 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004143 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004144 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004145 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4146 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004147 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4148 ;}
4149 break;
4150
zmo@google.com09c323a2011-08-12 18:22:25 +00004151 case 163:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004152
4153 {
4154 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4155 ;}
4156 break;
4157
zmo@google.com09c323a2011-08-12 18:22:25 +00004158 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004159
4160 {
4161 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4162 ;}
4163 break;
4164
zmo@google.com09c323a2011-08-12 18:22:25 +00004165 case 165:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004166
4167 { (yyval.interm.intermNode) = 0; ;}
4168 break;
4169
zmo@google.com09c323a2011-08-12 18:22:25 +00004170 case 166:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004171
4172 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
4173 break;
4174
zmo@google.com09c323a2011-08-12 18:22:25 +00004175 case 167:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004176
4177 {
4178 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4179 context->recover();
4180 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4181 ;}
4182 break;
4183
zmo@google.com09c323a2011-08-12 18:22:25 +00004184 case 168:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004185
4186 {
4187 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4188 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4189 ;}
4190 break;
4191
zmo@google.com09c323a2011-08-12 18:22:25 +00004192 case 169:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004193
4194 {
4195 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4196 (yyval.interm.nodePair).node2 = 0;
4197 ;}
4198 break;
4199
zmo@google.com09c323a2011-08-12 18:22:25 +00004200 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004201
4202 {
4203 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4204 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4205 context->recover();
4206 ;}
4207 break;
4208
zmo@google.com09c323a2011-08-12 18:22:25 +00004209 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004210
4211 {
4212 TIntermNode* intermNode;
4213 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4214 context->recover();
4215 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4216 context->recover();
4217
4218 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4219 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4220 else {
4221 context->recover();
4222 (yyval.interm.intermTypedNode) = 0;
4223 }
4224 ;}
4225 break;
4226
zmo@google.com09c323a2011-08-12 18:22:25 +00004227 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004228
4229 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
4230 break;
4231
zmo@google.com09c323a2011-08-12 18:22:25 +00004232 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004233
4234 {
4235 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004236 (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 +00004237 --context->loopNestingLevel;
4238 ;}
4239 break;
4240
zmo@google.com09c323a2011-08-12 18:22:25 +00004241 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004242
4243 { ++context->loopNestingLevel; ;}
4244 break;
4245
zmo@google.com09c323a2011-08-12 18:22:25 +00004246 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004247
4248 {
4249 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4250 context->recover();
4251
alokp@chromium.org52813552010-11-16 18:36:09 +00004252 (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 +00004253 --context->loopNestingLevel;
4254 ;}
4255 break;
4256
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004257 case 176:
4258
zmo@google.com09c323a2011-08-12 18:22:25 +00004259 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004260 break;
4261
4262 case 177:
4263
4264 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004265 context->symbolTable.pop();
4266 (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);
4267 --context->loopNestingLevel;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004268 ;}
4269 break;
4270
4271 case 178:
4272
4273 {
4274 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4275 ;}
4276 break;
4277
4278 case 179:
4279
4280 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004281 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004282 ;}
4283 break;
4284
4285 case 180:
4286
4287 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004288 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004289 ;}
4290 break;
4291
4292 case 181:
4293
4294 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004295 (yyval.interm.intermTypedNode) = 0;
4296 ;}
4297 break;
4298
4299 case 182:
4300
4301 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004302 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4303 (yyval.interm.nodePair).node2 = 0;
4304 ;}
4305 break;
4306
zmo@google.com09c323a2011-08-12 18:22:25 +00004307 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004308
4309 {
4310 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4311 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4312 ;}
4313 break;
4314
zmo@google.com09c323a2011-08-12 18:22:25 +00004315 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004316
4317 {
4318 if (context->loopNestingLevel <= 0) {
4319 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4320 context->recover();
4321 }
4322 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4323 ;}
4324 break;
4325
zmo@google.com09c323a2011-08-12 18:22:25 +00004326 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004327
4328 {
4329 if (context->loopNestingLevel <= 0) {
4330 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4331 context->recover();
4332 }
4333 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4334 ;}
4335 break;
4336
zmo@google.com09c323a2011-08-12 18:22:25 +00004337 case 186:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004338
4339 {
4340 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4341 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4342 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4343 context->recover();
4344 }
4345 ;}
4346 break;
4347
zmo@google.com09c323a2011-08-12 18:22:25 +00004348 case 187:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004349
4350 {
4351 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4352 context->functionReturnsValue = true;
4353 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4354 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4355 context->recover();
4356 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4357 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4358 context->recover();
4359 }
4360 ;}
4361 break;
4362
zmo@google.com09c323a2011-08-12 18:22:25 +00004363 case 188:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004364
4365 {
4366 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4367 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4368 ;}
4369 break;
4370
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004371 case 189:
4372
4373 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004374 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004375 context->treeRoot = (yyval.interm.intermNode);
4376 ;}
4377 break;
4378
4379 case 190:
4380
4381 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004382 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4383 context->treeRoot = (yyval.interm.intermNode);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004384 ;}
4385 break;
4386
4387 case 191:
4388
4389 {
4390 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4391 ;}
4392 break;
4393
4394 case 192:
4395
4396 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004397 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4398 ;}
4399 break;
4400
4401 case 193:
4402
4403 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004404 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4405 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4406 //
4407 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4408 // as it would have just been put in the symbol table. Otherwise, we're looking up
4409 // an earlier occurance.
4410 //
4411 if (prevDec->isDefined()) {
4412 //
4413 // Then this function already has a body.
4414 //
4415 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4416 context->recover();
4417 }
4418 prevDec->setDefined();
4419
4420 //
4421 // Raise error message if main function takes any parameters or return anything other than void
4422 //
4423 if (function->getName() == "main") {
4424 if (function->getParamCount() > 0) {
4425 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4426 context->recover();
4427 }
4428 if (function->getReturnType().getBasicType() != EbtVoid) {
4429 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4430 context->recover();
4431 }
4432 }
4433
4434 //
4435 // New symbol table scope for body of function plus its arguments
4436 //
4437 context->symbolTable.push();
4438
4439 //
4440 // Remember the return type for later checking for RETURN statements.
4441 //
4442 context->currentFunctionType = &(prevDec->getReturnType());
4443 context->functionReturnsValue = false;
4444
4445 //
4446 // Insert parameters into the symbol table.
4447 // If the parameter has no name, it's not an error, just don't insert it
4448 // (could be used for unused args).
4449 //
4450 // Also, accumulate the list of parameters into the HIL, so lower level code
4451 // knows where to find parameters.
4452 //
4453 TIntermAggregate* paramNodes = new TIntermAggregate;
4454 for (int i = 0; i < function->getParamCount(); i++) {
4455 const TParameter& param = function->getParam(i);
4456 if (param.name != 0) {
4457 TVariable *variable = new TVariable(param.name, *param.type);
4458 //
4459 // Insert the parameters with name in the symbol table.
4460 //
4461 if (! context->symbolTable.insert(*variable)) {
4462 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4463 context->recover();
4464 delete variable;
4465 }
4466
4467 //
4468 // Add the parameter to the HIL
4469 //
4470 paramNodes = context->intermediate.growAggregate(
4471 paramNodes,
4472 context->intermediate.addSymbol(variable->getUniqueId(),
4473 variable->getName(),
4474 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4475 (yyvsp[(1) - (1)].interm).line);
4476 } else {
4477 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4478 }
4479 }
4480 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4481 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4482 context->loopNestingLevel = 0;
4483 ;}
4484 break;
4485
zmo@google.com09c323a2011-08-12 18:22:25 +00004486 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004487
4488 {
4489 //?? Check that all paths return a value if return type != void ?
4490 // May be best done as post process phase on intermediate code
4491 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4492 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4493 context->recover();
4494 }
4495 context->symbolTable.pop();
4496 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4497 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4498 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4499 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4500
4501 // store the pragma information for debug and optimize and other vendor specific
4502 // information. This information can be queried from the parse tree
4503 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4504 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4505 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004506
4507 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4508 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004509 ;}
4510 break;
4511
4512
4513/* Line 1267 of yacc.c. */
4514
4515 default: break;
4516 }
4517 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4518
4519 YYPOPSTACK (yylen);
4520 yylen = 0;
4521 YY_STACK_PRINT (yyss, yyssp);
4522
4523 *++yyvsp = yyval;
4524
4525
4526 /* Now `shift' the result of the reduction. Determine what state
4527 that goes to, based on the state we popped back to and the rule
4528 number reduced by. */
4529
4530 yyn = yyr1[yyn];
4531
4532 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4533 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4534 yystate = yytable[yystate];
4535 else
4536 yystate = yydefgoto[yyn - YYNTOKENS];
4537
4538 goto yynewstate;
4539
4540
4541/*------------------------------------.
4542| yyerrlab -- here on detecting error |
4543`------------------------------------*/
4544yyerrlab:
4545 /* If not already recovering from an error, report this error. */
4546 if (!yyerrstatus)
4547 {
4548 ++yynerrs;
4549#if ! YYERROR_VERBOSE
4550 yyerror (context, YY_("syntax error"));
4551#else
4552 {
4553 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4554 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4555 {
4556 YYSIZE_T yyalloc = 2 * yysize;
4557 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4558 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4559 if (yymsg != yymsgbuf)
4560 YYSTACK_FREE (yymsg);
4561 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4562 if (yymsg)
4563 yymsg_alloc = yyalloc;
4564 else
4565 {
4566 yymsg = yymsgbuf;
4567 yymsg_alloc = sizeof yymsgbuf;
4568 }
4569 }
4570
4571 if (0 < yysize && yysize <= yymsg_alloc)
4572 {
4573 (void) yysyntax_error (yymsg, yystate, yychar);
4574 yyerror (context, yymsg);
4575 }
4576 else
4577 {
4578 yyerror (context, YY_("syntax error"));
4579 if (yysize != 0)
4580 goto yyexhaustedlab;
4581 }
4582 }
4583#endif
4584 }
4585
4586
4587
4588 if (yyerrstatus == 3)
4589 {
4590 /* If just tried and failed to reuse look-ahead token after an
4591 error, discard it. */
4592
4593 if (yychar <= YYEOF)
4594 {
4595 /* Return failure if at end of input. */
4596 if (yychar == YYEOF)
4597 YYABORT;
4598 }
4599 else
4600 {
4601 yydestruct ("Error: discarding",
4602 yytoken, &yylval, context);
4603 yychar = YYEMPTY;
4604 }
4605 }
4606
4607 /* Else will try to reuse look-ahead token after shifting the error
4608 token. */
4609 goto yyerrlab1;
4610
4611
4612/*---------------------------------------------------.
4613| yyerrorlab -- error raised explicitly by YYERROR. |
4614`---------------------------------------------------*/
4615yyerrorlab:
4616
4617 /* Pacify compilers like GCC when the user code never invokes
4618 YYERROR and the label yyerrorlab therefore never appears in user
4619 code. */
4620 if (/*CONSTCOND*/ 0)
4621 goto yyerrorlab;
4622
4623 /* Do not reclaim the symbols of the rule which action triggered
4624 this YYERROR. */
4625 YYPOPSTACK (yylen);
4626 yylen = 0;
4627 YY_STACK_PRINT (yyss, yyssp);
4628 yystate = *yyssp;
4629 goto yyerrlab1;
4630
4631
4632/*-------------------------------------------------------------.
4633| yyerrlab1 -- common code for both syntax error and YYERROR. |
4634`-------------------------------------------------------------*/
4635yyerrlab1:
4636 yyerrstatus = 3; /* Each real token shifted decrements this. */
4637
4638 for (;;)
4639 {
4640 yyn = yypact[yystate];
4641 if (yyn != YYPACT_NINF)
4642 {
4643 yyn += YYTERROR;
4644 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4645 {
4646 yyn = yytable[yyn];
4647 if (0 < yyn)
4648 break;
4649 }
4650 }
4651
4652 /* Pop the current state because it cannot handle the error token. */
4653 if (yyssp == yyss)
4654 YYABORT;
4655
4656
4657 yydestruct ("Error: popping",
4658 yystos[yystate], yyvsp, context);
4659 YYPOPSTACK (1);
4660 yystate = *yyssp;
4661 YY_STACK_PRINT (yyss, yyssp);
4662 }
4663
4664 if (yyn == YYFINAL)
4665 YYACCEPT;
4666
4667 *++yyvsp = yylval;
4668
4669
4670 /* Shift the error token. */
4671 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4672
4673 yystate = yyn;
4674 goto yynewstate;
4675
4676
4677/*-------------------------------------.
4678| yyacceptlab -- YYACCEPT comes here. |
4679`-------------------------------------*/
4680yyacceptlab:
4681 yyresult = 0;
4682 goto yyreturn;
4683
4684/*-----------------------------------.
4685| yyabortlab -- YYABORT comes here. |
4686`-----------------------------------*/
4687yyabortlab:
4688 yyresult = 1;
4689 goto yyreturn;
4690
4691#ifndef yyoverflow
4692/*-------------------------------------------------.
4693| yyexhaustedlab -- memory exhaustion comes here. |
4694`-------------------------------------------------*/
4695yyexhaustedlab:
4696 yyerror (context, YY_("memory exhausted"));
4697 yyresult = 2;
4698 /* Fall through. */
4699#endif
4700
4701yyreturn:
4702 if (yychar != YYEOF && yychar != YYEMPTY)
4703 yydestruct ("Cleanup: discarding lookahead",
4704 yytoken, &yylval, context);
4705 /* Do not reclaim the symbols of the rule which action triggered
4706 this YYABORT or YYACCEPT. */
4707 YYPOPSTACK (yylen);
4708 YY_STACK_PRINT (yyss, yyssp);
4709 while (yyssp != yyss)
4710 {
4711 yydestruct ("Cleanup: popping",
4712 yystos[*yyssp], yyvsp, context);
4713 YYPOPSTACK (1);
4714 }
4715#ifndef yyoverflow
4716 if (yyss != yyssa)
4717 YYSTACK_FREE (yyss);
4718#endif
4719#if YYERROR_VERBOSE
4720 if (yymsg != yymsgbuf)
4721 YYSTACK_FREE (yymsg);
4722#endif
4723 /* Make sure YYID is used. */
4724 return YYID (yyresult);
4725}
4726
4727
4728
4729
4730
4731int glslang_parse(TParseContext* context) {
4732 return yyparse(context);
4733}
4734
4735