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