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