1
/* A Bison parser, made by GNU Bison 1.875. */
3
/* Skeleton parser for Yacc-like parsing with Bison,
4
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA. */
21
/* As a special exception, when this file is copied by Bison into a
22
Bison output file, you may use that output file without restriction.
23
This special exception was added by the Free Software Foundation
24
in version 1.24 of Bison. */
26
/* Written by Richard Stallman by simplifying the original so called
27
``semantic'' parser. */
29
/* All symbols defined below should begin with yy or YY, to avoid
30
infringing on user name space. This should be done even for local
31
variables, as they might otherwise be expanded by user macros.
32
There are some unavoidable exceptions within include files to
33
define necessary library symbols; they are noted "INFRINGES ON
34
USER NAME SPACE" below. */
36
/* Identify Bison output. */
40
#define YYSKELETON_NAME "yacc.c"
45
/* Using locations. */
46
#define YYLSP_NEEDED 0
53
/* Put the tokens into the symbol table, so that GDB and other debuggers
93
SAMPLER1DSHADOW = 295,
94
SAMPLER2DSHADOW = 296,
100
FIELD_SELECTION = 302,
148
#define ATTRIBUTE 258
149
#define CONST_QUAL 259
150
#define BOOL_TYPE 260
151
#define FLOAT_TYPE 261
175
#define INOUT_QUAL 285
179
#define VOID_TYPE 289
181
#define SAMPLER1D 291
182
#define SAMPLER2D 292
183
#define SAMPLER3D 293
184
#define SAMPLERCUBE 294
185
#define SAMPLER1DSHADOW 295
186
#define SAMPLER2DSHADOW 296
187
#define IDENTIFIER 297
188
#define TYPE_NAME 298
189
#define FLOATCONSTANT 299
190
#define INTCONSTANT 300
191
#define BOOLCONSTANT 301
192
#define FIELD_SELECTION 302
204
#define MUL_ASSIGN 314
205
#define DIV_ASSIGN 315
206
#define ADD_ASSIGN 316
207
#define MOD_ASSIGN 317
208
#define LEFT_ASSIGN 318
209
#define RIGHT_ASSIGN 319
210
#define AND_ASSIGN 320
211
#define XOR_ASSIGN 321
212
#define OR_ASSIGN 322
213
#define SUB_ASSIGN 323
214
#define LEFT_PAREN 324
215
#define RIGHT_PAREN 325
216
#define LEFT_BRACKET 326
217
#define RIGHT_BRACKET 327
218
#define LEFT_BRACE 328
219
#define RIGHT_BRACE 329
224
#define SEMICOLON 334
232
#define LEFT_ANGLE 342
233
#define RIGHT_ANGLE 343
234
#define VERTICAL_BAR 344
236
#define AMPERSAND 346
242
/* Copy the first part of user declarations. */
249
In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
250
matching Lex specification) for the April 30, 1985 draft version of the
251
ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that
252
original, as mentioned in the answer to question 17.25 of the comp.lang.c
253
FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
255
I intend to keep this version as close to the current C Standard grammar as
256
possible; please let me know if you discover discrepancies.
261
#include "SymbolTable.h"
262
#include "ParseHelper.h"
263
#include "../Public/ShaderLang.h"
266
#define YYPARSE_PARAM parseContext
267
#define YYPARSE_PARAM_DECL TParseContext&
268
#define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext)
269
#define YYLEX_PARAM parseContext
271
#define YYPARSE_PARAM parseContextLocal
272
#define parseContext (*((TParseContext*)(parseContextLocal)))
273
#define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
274
#define YYLEX_PARAM (void*)(parseContextLocal)
275
extern void yyerror(char*);
278
#define FRAG_VERT_ONLY(S, L) { \
279
if (parseContext.language != EShLangFragment && \
280
parseContext.language != EShLangVertex) { \
281
parseContext.error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
282
parseContext.recover(); \
286
#define VERTEX_ONLY(S, L) { \
287
if (parseContext.language != EShLangVertex) { \
288
parseContext.error(L, " supported in vertex shaders only ", S, "", ""); \
289
parseContext.recover(); \
293
#define FRAG_ONLY(S, L) { \
294
if (parseContext.language != EShLangFragment) { \
295
parseContext.error(L, " supported in fragment shaders only ", S, "", ""); \
296
parseContext.recover(); \
300
#define PACK_ONLY(S, L) { \
301
if (parseContext.language != EShLangPack) { \
302
parseContext.error(L, " supported in pack shaders only ", S, "", ""); \
303
parseContext.recover(); \
307
#define UNPACK_ONLY(S, L) { \
308
if (parseContext.language != EShLangUnpack) { \
309
parseContext.error(L, " supported in unpack shaders only ", S, "", ""); \
310
parseContext.recover(); \
314
#define PACK_UNPACK_ONLY(S, L) { \
315
if (parseContext.language != EShLangUnpack && \
316
parseContext.language != EShLangPack) { \
317
parseContext.error(L, " supported in pack/unpack shaders only ", S, "", ""); \
318
parseContext.recover(); \
323
/* Enabling traces. */
328
/* Enabling verbose error messages. */
329
#ifdef YYERROR_VERBOSE
330
# undef YYERROR_VERBOSE
331
# define YYERROR_VERBOSE 1
333
# define YYERROR_VERBOSE 0
336
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
337
#line 117 "glslang.y"
338
typedef union YYSTYPE {
353
TIntermNode* intermNode;
354
TIntermNodePair nodePair;
355
TIntermTyped* intermTypedNode;
356
TIntermAggregate* intermAggregate;
360
TQualifier qualifier;
368
/* Line 191 of yacc.c. */
369
#line 369 "glslang.tab.c"
370
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
371
# define YYSTYPE_IS_DECLARED 1
372
# define YYSTYPE_IS_TRIVIAL 1
377
/* Copy the second part of user declarations. */
378
#line 148 "glslang.y"
381
extern int yylex(YYSTYPE*, void*);
385
/* Line 214 of yacc.c. */
386
#line 386 "glslang.tab.c"
388
#if ! defined (yyoverflow) || YYERROR_VERBOSE
390
/* The parser invokes alloca or malloc; define the necessary symbols. */
392
# if YYSTACK_USE_ALLOCA
393
# define YYSTACK_ALLOC alloca
395
# ifndef YYSTACK_USE_ALLOCA
396
# if defined (alloca) || defined (_ALLOCA_H)
397
# define YYSTACK_ALLOC alloca
400
# define YYSTACK_ALLOC __builtin_alloca
406
# ifdef YYSTACK_ALLOC
407
/* Pacify GCC's `empty if-body' warning. */
408
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
410
# if defined (__STDC__) || defined (__cplusplus)
411
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
412
# define YYSIZE_T size_t
414
# define YYSTACK_ALLOC malloc
415
# define YYSTACK_FREE free
417
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
420
#if (! defined (yyoverflow) \
421
&& (! defined (__cplusplus) \
422
|| (YYSTYPE_IS_TRIVIAL)))
424
/* A type that is properly aligned for any stack member. */
431
/* The size of the maximum gap between one aligned stack and the next. */
432
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
434
/* The size of an array large to enough to hold all stacks, each with
436
# define YYSTACK_BYTES(N) \
437
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
438
+ YYSTACK_GAP_MAXIMUM)
440
/* Copy COUNT objects from FROM to TO. The source and destination do
444
# define YYCOPY(To, From, Count) \
445
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
447
# define YYCOPY(To, From, Count) \
450
register YYSIZE_T yyi; \
451
for (yyi = 0; yyi < (Count); yyi++) \
452
(To)[yyi] = (From)[yyi]; \
458
/* Relocate STACK from its old location to the new one. The
459
local variables YYSIZE and YYSTACKSIZE give the old and new number of
460
elements in the stack, and YYPTR gives the new location of the
461
stack. Advance YYPTR to a properly aligned location for the next
463
# define YYSTACK_RELOCATE(Stack) \
466
YYSIZE_T yynewbytes; \
467
YYCOPY (&yyptr->Stack, Stack, yysize); \
468
Stack = &yyptr->Stack; \
469
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
470
yyptr += yynewbytes / sizeof (*yyptr); \
476
#if defined (__STDC__) || defined (__cplusplus)
477
typedef signed char yysigned_char;
479
typedef short yysigned_char;
482
/* YYFINAL -- State number of the termination state. */
484
/* YYLAST -- Last index in YYTABLE. */
487
/* YYNTOKENS -- Number of terminals. */
489
/* YYNNTS -- Number of nonterminals. */
491
/* YYNRULES -- Number of rules. */
493
/* YYNRULES -- Number of states. */
494
#define YYNSTATES 331
496
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
498
#define YYMAXUTOK 347
500
#define YYTRANSLATE(YYX) \
501
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
503
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
504
static const unsigned char yytranslate[] =
506
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
532
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
533
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
534
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
535
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
536
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
537
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
538
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
539
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
540
85, 86, 87, 88, 89, 90, 91, 92
544
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
546
static const unsigned short yyprhs[] =
548
0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
549
24, 26, 30, 33, 36, 38, 40, 43, 46, 49,
550
51, 54, 58, 61, 63, 65, 67, 69, 71, 73,
551
75, 77, 79, 81, 83, 85, 87, 89, 91, 93,
552
95, 97, 99, 102, 105, 108, 110, 112, 114, 116,
553
118, 122, 126, 130, 132, 136, 140, 142, 146, 150,
554
152, 156, 160, 164, 168, 170, 174, 178, 180, 184,
555
186, 190, 192, 196, 198, 202, 204, 208, 210, 214,
556
216, 222, 224, 228, 230, 232, 234, 236, 238, 240,
557
242, 244, 246, 248, 250, 252, 256, 258, 261, 264,
558
267, 269, 271, 274, 278, 282, 285, 291, 295, 298,
559
302, 305, 306, 308, 310, 312, 314, 319, 321, 325,
560
331, 338, 344, 346, 349, 354, 360, 365, 367, 370,
561
372, 374, 376, 378, 380, 382, 384, 386, 388, 390,
562
392, 394, 396, 398, 400, 402, 404, 406, 408, 410,
563
412, 414, 416, 418, 420, 422, 424, 426, 432, 437,
564
439, 442, 446, 448, 452, 454, 459, 461, 463, 465,
565
467, 469, 471, 473, 475, 477, 480, 481, 482, 488,
566
490, 492, 495, 499, 501, 504, 506, 509, 515, 519,
567
521, 523, 528, 529, 536, 537, 546, 547, 555, 557,
568
559, 561, 562, 565, 569, 572, 575, 578, 582, 585,
569
587, 590, 592, 594, 595
572
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
573
static const short yyrhs[] =
575
164, 0, -1, 42, -1, 94, -1, 45, -1, 44,
576
-1, 46, -1, 69, 121, 70, -1, 95, -1, 96,
577
71, 97, 72, -1, 98, -1, 96, 75, 47, -1,
578
96, 50, -1, 96, 51, -1, 121, -1, 99, -1,
579
101, 70, -1, 100, 70, -1, 102, 34, -1, 102,
580
-1, 102, 119, -1, 101, 76, 119, -1, 103, 69,
581
-1, 104, -1, 42, -1, 6, -1, 7, -1, 5,
582
-1, 22, -1, 23, -1, 24, -1, 16, -1, 17,
583
-1, 18, -1, 19, -1, 20, -1, 21, -1, 25,
584
-1, 26, -1, 27, -1, 43, -1, 96, -1, 50,
585
105, -1, 51, 105, -1, 106, 105, -1, 83, -1,
586
81, -1, 80, -1, 82, -1, 105, -1, 107, 84,
587
105, -1, 107, 85, 105, -1, 107, 86, 105, -1,
588
107, -1, 108, 83, 107, -1, 108, 81, 107, -1,
589
108, -1, 109, 48, 108, -1, 109, 49, 108, -1,
590
109, -1, 110, 87, 109, -1, 110, 88, 109, -1,
591
110, 52, 109, -1, 110, 53, 109, -1, 110, -1,
592
111, 54, 110, -1, 111, 55, 110, -1, 111, -1,
593
112, 91, 111, -1, 112, -1, 113, 90, 112, -1,
594
113, -1, 114, 89, 113, -1, 114, -1, 115, 56,
595
114, -1, 115, -1, 116, 58, 115, -1, 116, -1,
596
117, 57, 116, -1, 117, -1, 117, 92, 121, 77,
597
119, -1, 118, -1, 105, 120, 119, -1, 78, -1,
598
59, -1, 60, -1, 62, -1, 61, -1, 68, -1,
599
63, -1, 64, -1, 65, -1, 66, -1, 67, -1,
600
119, -1, 121, 76, 119, -1, 118, -1, 124, 79,
601
-1, 132, 79, -1, 125, 70, -1, 127, -1, 126,
602
-1, 127, 129, -1, 126, 76, 129, -1, 134, 42,
603
69, -1, 136, 42, -1, 136, 42, 71, 122, 72,
604
-1, 135, 130, 128, -1, 130, 128, -1, 135, 130,
605
131, -1, 130, 131, -1, -1, 28, -1, 29, -1,
606
30, -1, 136, -1, 136, 71, 122, 72, -1, 133,
607
-1, 132, 76, 42, -1, 132, 76, 42, 71, 72,
608
-1, 132, 76, 42, 71, 122, 72, -1, 132, 76,
609
42, 78, 142, -1, 134, -1, 134, 42, -1, 134,
610
42, 71, 72, -1, 134, 42, 71, 122, 72, -1,
611
134, 42, 78, 142, -1, 136, -1, 135, 136, -1,
612
4, -1, 3, -1, 32, -1, 31, -1, 34, -1,
613
6, -1, 7, -1, 5, -1, 22, -1, 23, -1,
614
24, -1, 16, -1, 17, -1, 18, -1, 19, -1,
615
20, -1, 21, -1, 25, -1, 26, -1, 27, -1,
616
36, -1, 37, -1, 38, -1, 39, -1, 40, -1,
617
41, -1, 137, -1, 43, -1, 33, 42, 73, 138,
618
74, -1, 33, 73, 138, 74, -1, 139, -1, 138,
619
139, -1, 136, 140, 79, -1, 141, -1, 140, 76,
620
141, -1, 42, -1, 42, 71, 122, 72, -1, 119,
621
-1, 123, -1, 146, -1, 145, -1, 143, -1, 152,
622
-1, 153, -1, 156, -1, 163, -1, 73, 74, -1,
623
-1, -1, 73, 147, 151, 148, 74, -1, 150, -1,
624
145, -1, 73, 74, -1, 73, 151, 74, -1, 144,
625
-1, 151, 144, -1, 79, -1, 121, 79, -1, 13,
626
69, 121, 70, 154, -1, 144, 11, 144, -1, 144,
627
-1, 121, -1, 134, 42, 78, 142, -1, -1, 35,
628
69, 157, 155, 70, 149, -1, -1, 10, 158, 144,
629
35, 69, 121, 70, 79, -1, -1, 12, 69, 159,
630
160, 162, 70, 149, -1, 152, -1, 143, -1, 155,
631
-1, -1, 161, 79, -1, 161, 79, 121, -1, 9,
632
79, -1, 8, 79, -1, 15, 79, -1, 15, 121,
633
79, -1, 14, 79, -1, 165, -1, 164, 165, -1,
634
166, -1, 123, -1, -1, 124, 167, 150, -1
637
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
638
static const unsigned short yyrline[] =
640
0, 210, 210, 245, 248, 261, 266, 271, 277, 280,
641
348, 351, 460, 470, 483, 491, 586, 590, 597, 601,
642
608, 614, 623, 629, 640, 656, 657, 658, 659, 660,
643
661, 662, 663, 664, 665, 666, 667, 668, 669, 670,
644
671, 682, 685, 695, 705, 727, 728, 729, 730, 736,
645
737, 746, 755, 767, 768, 776, 787, 788, 797, 809,
646
810, 820, 830, 840, 853, 854, 864, 877, 878, 890,
647
891, 903, 904, 916, 917, 930, 931, 944, 945, 958,
648
959, 976, 977, 990, 991, 992, 993, 994, 995, 996,
649
997, 998, 999, 1000, 1004, 1007, 1018, 1026, 1027, 1035,
650
1071, 1074, 1081, 1089, 1110, 1129, 1140, 1167, 1172, 1182,
651
1187, 1197, 1200, 1203, 1206, 1212, 1217, 1235, 1238, 1246,
652
1254, 1262, 1284, 1288, 1297, 1306, 1315, 1405, 1408, 1425,
653
1429, 1436, 1444, 1453, 1458, 1463, 1468, 1479, 1484, 1489,
654
1494, 1499, 1504, 1509, 1514, 1519, 1524, 1530, 1536, 1542,
655
1548, 1554, 1560, 1566, 1572, 1578, 1583, 1596, 1606, 1614,
656
1617, 1632, 1650, 1654, 1660, 1665, 1681, 1685, 1689, 1690,
657
1696, 1697, 1698, 1699, 1700, 1704, 1705, 1705, 1705, 1713,
658
1714, 1719, 1722, 1730, 1733, 1739, 1740, 1744, 1752, 1756,
659
1766, 1771, 1788, 1788, 1793, 1793, 1800, 1800, 1813, 1816,
660
1822, 1825, 1831, 1835, 1842, 1849, 1856, 1863, 1874, 1883,
661
1887, 1894, 1897, 1903, 1903
665
#if YYDEBUG || YYERROR_VERBOSE
666
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
667
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
668
static const char *const yytname[] =
670
"$end", "error", "$undefined", "ATTRIBUTE", "CONST_QUAL", "BOOL_TYPE",
671
"FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE", "DO", "ELSE", "FOR",
672
"IF", "DISCARD", "RETURN", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
673
"IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2", "MATRIX3", "MATRIX4",
674
"IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM", "VARYING", "STRUCT",
675
"VOID_TYPE", "WHILE", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D",
676
"SAMPLERCUBE", "SAMPLER1DSHADOW", "SAMPLER2DSHADOW", "IDENTIFIER",
677
"TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT",
678
"FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP",
679
"GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN",
680
"DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN",
681
"AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN",
682
"RIGHT_PAREN", "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE",
683
"RIGHT_BRACE", "DOT", "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG",
684
"DASH", "TILDE", "PLUS", "STAR", "SLASH", "PERCENT", "LEFT_ANGLE",
685
"RIGHT_ANGLE", "VERTICAL_BAR", "CARET", "AMPERSAND", "QUESTION",
686
"$accept", "variable_identifier", "primary_expression",
687
"postfix_expression", "integer_expression", "function_call",
688
"function_call_generic", "function_call_header_no_parameters",
689
"function_call_header_with_parameters", "function_call_header",
690
"function_identifier", "constructor_identifier", "unary_expression",
691
"unary_operator", "multiplicative_expression", "additive_expression",
692
"shift_expression", "relational_expression", "equality_expression",
693
"and_expression", "exclusive_or_expression", "inclusive_or_expression",
694
"logical_and_expression", "logical_xor_expression",
695
"logical_or_expression", "conditional_expression",
696
"assignment_expression", "assignment_operator", "expression",
697
"constant_expression", "declaration", "function_prototype",
698
"function_declarator", "function_header_with_parameters",
699
"function_header", "parameter_declarator", "parameter_declaration",
700
"parameter_qualifier", "parameter_type_specifier",
701
"init_declarator_list", "single_declaration", "fully_specified_type",
702
"type_qualifier", "type_specifier", "struct_specifier",
703
"struct_declaration_list", "struct_declaration",
704
"struct_declarator_list", "struct_declarator", "initializer",
705
"declaration_statement", "statement", "simple_statement",
706
"compound_statement", "@1", "@2", "statement_no_new_scope",
707
"compound_statement_no_new_scope", "statement_list",
708
"expression_statement", "selection_statement",
709
"selection_rest_statement", "condition", "iteration_statement", "@3",
710
"@4", "@5", "for_init_statement", "conditionopt", "for_rest_statement",
711
"jump_statement", "translation_unit", "external_declaration",
712
"function_definition", "@6", 0
717
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
719
static const unsigned short yytoknum[] =
721
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
722
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
723
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
724
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
725
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
726
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
727
315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
728
325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
729
335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
734
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
735
static const unsigned char yyr1[] =
737
0, 93, 94, 95, 95, 95, 95, 95, 96, 96,
738
96, 96, 96, 96, 97, 98, 99, 99, 100, 100,
739
101, 101, 102, 103, 103, 104, 104, 104, 104, 104,
740
104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
741
104, 105, 105, 105, 105, 106, 106, 106, 106, 107,
742
107, 107, 107, 108, 108, 108, 109, 109, 109, 110,
743
110, 110, 110, 110, 111, 111, 111, 112, 112, 113,
744
113, 114, 114, 115, 115, 116, 116, 117, 117, 118,
745
118, 119, 119, 120, 120, 120, 120, 120, 120, 120,
746
120, 120, 120, 120, 121, 121, 122, 123, 123, 124,
747
125, 125, 126, 126, 127, 128, 128, 129, 129, 129,
748
129, 130, 130, 130, 130, 131, 131, 132, 132, 132,
749
132, 132, 133, 133, 133, 133, 133, 134, 134, 135,
750
135, 135, 135, 136, 136, 136, 136, 136, 136, 136,
751
136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
752
136, 136, 136, 136, 136, 136, 136, 137, 137, 138,
753
138, 139, 140, 140, 141, 141, 142, 143, 144, 144,
754
145, 145, 145, 145, 145, 146, 147, 148, 146, 149,
755
149, 150, 150, 151, 151, 152, 152, 153, 154, 154,
756
155, 155, 157, 156, 158, 156, 159, 156, 160, 160,
757
161, 161, 162, 162, 163, 163, 163, 163, 163, 164,
758
164, 165, 165, 167, 166
761
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
762
static const unsigned char yyr2[] =
764
0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
765
1, 3, 2, 2, 1, 1, 2, 2, 2, 1,
766
2, 3, 2, 1, 1, 1, 1, 1, 1, 1,
767
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
768
1, 1, 2, 2, 2, 1, 1, 1, 1, 1,
769
3, 3, 3, 1, 3, 3, 1, 3, 3, 1,
770
3, 3, 3, 3, 1, 3, 3, 1, 3, 1,
771
3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
772
5, 1, 3, 1, 1, 1, 1, 1, 1, 1,
773
1, 1, 1, 1, 1, 3, 1, 2, 2, 2,
774
1, 1, 2, 3, 3, 2, 5, 3, 2, 3,
775
2, 0, 1, 1, 1, 1, 4, 1, 3, 5,
776
6, 5, 1, 2, 4, 5, 4, 1, 2, 1,
777
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
778
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
779
1, 1, 1, 1, 1, 1, 1, 5, 4, 1,
780
2, 3, 1, 3, 1, 4, 1, 1, 1, 1,
781
1, 1, 1, 1, 1, 2, 0, 0, 5, 1,
782
1, 2, 3, 1, 2, 1, 2, 5, 3, 1,
783
1, 4, 0, 6, 0, 8, 0, 7, 1, 1,
784
1, 0, 2, 3, 2, 2, 2, 3, 2, 1,
788
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
789
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
790
means the default is an error. */
791
static const unsigned char yydefact[] =
793
0, 130, 129, 136, 134, 135, 140, 141, 142, 143,
794
144, 145, 137, 138, 139, 146, 147, 148, 132, 131,
795
0, 133, 149, 150, 151, 152, 153, 154, 156, 212,
796
213, 0, 101, 111, 0, 117, 122, 0, 127, 155,
797
0, 209, 211, 0, 0, 97, 0, 99, 111, 112,
798
113, 114, 102, 0, 111, 0, 98, 123, 128, 1,
799
210, 0, 0, 0, 159, 0, 214, 103, 108, 110,
800
115, 0, 118, 104, 0, 0, 0, 164, 0, 162,
801
158, 160, 136, 134, 135, 0, 0, 194, 0, 0,
802
0, 0, 140, 141, 142, 143, 144, 145, 137, 138,
803
139, 146, 147, 148, 0, 2, 156, 5, 4, 6,
804
0, 0, 0, 176, 181, 185, 47, 46, 48, 45,
805
3, 8, 41, 10, 15, 0, 0, 19, 0, 23,
806
49, 0, 53, 56, 59, 64, 67, 69, 71, 73,
807
75, 77, 79, 81, 94, 0, 167, 0, 170, 183,
808
169, 168, 0, 171, 172, 173, 174, 105, 0, 107,
809
109, 0, 0, 27, 25, 26, 31, 32, 33, 34,
810
35, 36, 28, 29, 30, 37, 38, 39, 40, 124,
811
49, 96, 0, 166, 126, 157, 0, 0, 161, 205,
812
204, 0, 196, 0, 208, 206, 0, 192, 42, 43,
813
0, 175, 0, 12, 13, 0, 0, 17, 16, 0,
814
18, 20, 22, 84, 85, 87, 86, 89, 90, 91,
815
92, 93, 88, 83, 0, 44, 0, 0, 0, 0,
816
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
817
0, 0, 0, 0, 0, 0, 0, 186, 182, 184,
818
0, 0, 119, 0, 121, 125, 0, 163, 0, 0,
819
0, 207, 0, 7, 177, 0, 14, 11, 21, 82,
820
50, 51, 52, 55, 54, 57, 58, 62, 63, 60,
821
61, 65, 66, 68, 70, 72, 74, 76, 78, 0,
822
95, 0, 116, 120, 165, 0, 199, 198, 201, 0,
823
190, 0, 0, 0, 9, 0, 106, 0, 200, 0,
824
0, 189, 187, 0, 0, 178, 80, 0, 202, 0,
825
0, 0, 180, 193, 179, 0, 203, 197, 188, 191,
829
/* YYDEFGOTO[NTERM-NUM]. */
830
static const short yydefgoto[] =
832
-1, 120, 121, 122, 265, 123, 124, 125, 126, 127,
833
128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
834
138, 139, 140, 141, 142, 143, 144, 224, 145, 182,
835
146, 147, 31, 32, 33, 68, 52, 53, 69, 34,
836
35, 36, 37, 38, 39, 63, 64, 78, 79, 184,
837
148, 149, 150, 151, 202, 303, 323, 324, 152, 153,
838
154, 312, 302, 155, 262, 191, 259, 298, 309, 310,
842
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
844
#define YYPACT_NINF -297
845
static const short yypact[] =
847
1149, -297, -297, -297, -297, -297, -297, -297, -297, -297,
848
-297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
849
-27, -297, -297, -297, -297, -297, -297, -297, -297, -297,
850
-42, -28, -32, 4, 18, -297, 19, 1188, -297, -297,
851
1108, -297, -297, -10, 1188, -297, -3, -297, 36, -297,
852
-297, -297, -297, 1188, 83, 33, -297, -9, -297, -297,
853
-297, 1188, 39, 1025, -297, 235, -297, -297, -297, -297,
854
-18, 1188, -52, -297, 685, 957, 1064, -17, 20, -297,
855
-297, -297, 29, 45, 63, 21, 23, -297, 75, 77,
856
66, 753, 78, 79, 81, 82, 84, 85, 87, 89,
857
90, 91, 93, 94, 95, 96, 97, -297, -297, -297,
858
957, 957, 957, 120, -297, -297, -297, -297, -297, -297,
859
-297, -297, 5, -297, -297, 98, 1, 821, 100, -297,
860
57, 957, 42, -56, 37, -40, 76, 61, 80, 106,
861
111, 138, -41, -297, -297, 30, -297, -42, -297, -297,
862
-297, -297, 316, -297, -297, -297, -297, 127, 957, -297,
863
-297, 889, 957, -297, -297, -297, -297, -297, -297, -297,
864
-297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
865
-297, -297, 128, -297, -297, -297, 957, 39, -297, -297,
866
-297, 397, -297, 957, -297, -297, 31, -297, -297, -297,
867
3, -297, 397, -297, -297, 957, 152, -297, -297, 957,
868
-297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
869
-297, -297, -297, -297, 957, -297, 957, 957, 957, 957,
870
957, 957, 957, 957, 957, 957, 957, 957, 957, 957,
871
957, 957, 957, 957, 957, 957, 957, -297, -297, -297,
872
957, 129, -297, 130, -297, -297, 131, -297, 169, 549,
873
12, -297, 617, -297, 397, 133, 134, -297, -297, -297,
874
-297, -297, -297, 42, 42, -56, -56, 37, 37, 37,
875
37, -40, -40, 76, 61, 80, 106, 111, 138, 60,
876
-297, 135, -297, -297, -297, 137, -297, -297, 617, 397,
877
134, 167, 141, 140, -297, 957, -297, 957, -297, 136,
878
142, 205, -297, 143, 478, -297, -297, 13, 957, 478,
879
397, 957, -297, -297, -297, 139, 134, -297, -297, -297,
883
/* YYPGOTO[NTERM-NUM]. */
884
static const short yypgoto[] =
886
-297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
887
-297, -297, -53, -297, -91, -89, -143, -97, -20, -16,
888
-21, -15, -14, -22, -297, -57, -75, -297, -90, -155,
889
9, 10, -297, -297, -297, 154, 175, 172, 160, -297,
890
-297, -257, -19, -33, -297, 171, -4, -297, 46, -160,
891
-25, -107, -296, -297, -297, -297, -84, 190, 35, 6,
892
-297, -297, -35, -297, -297, -297, -297, -297, -297, -297,
893
-297, -297, 224, -297, -297
896
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
897
positive, shift that token. If negative, reduce the rule which
898
number is the opposite. If zero, do what YYDEFACT says.
899
If YYTABLE_NINF, syntax error. */
900
#define YYTABLE_NINF -101
901
static const short yytable[] =
903
183, 196, 254, 251, 58, 301, 253, 1, 2, 29,
904
30, 62, 233, 234, 54, 43, 244, 181, 322, 161,
905
70, 180, 200, 322, 157, 229, 162, 230, 62, 54,
906
62, 256, 49, 50, 51, 18, 19, 45, 70, 1,
907
2, 301, 47, 62, 48, 249, 44, 235, 236, 29,
908
30, 245, 211, 158, 186, 203, 204, 198, 199, 81,
909
73, 57, 74, 61, 49, 50, 51, 18, 19, 75,
910
65, 208, 81, 263, -100, 72, 205, 209, 225, 246,
911
206, 77, 299, 325, 258, 231, 232, 183, 246, 246,
912
277, 278, 279, 280, 55, 291, 187, 56, -27, 188,
913
189, 181, 190, 260, 181, 180, 246, 246, 180, 247,
914
261, 49, 50, 51, -25, 266, 213, 214, 215, 216,
915
217, 218, 219, 220, 221, 222, 226, 227, 228, 181,
916
237, 238, -26, 180, 268, 223, 246, 305, 273, 274,
917
281, 282, 275, 276, 192, 194, 193, -31, -32, 269,
918
-33, -34, 239, -35, -36, 289, -28, 249, -29, -30,
919
-37, 329, -38, -39, 197, -24, -40, 242, 207, 212,
920
240, 290, 300, 270, 271, 272, 180, 180, 180, 180,
921
180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
922
180, 180, 311, 181, 201, 241, 243, 180, 250, 267,
923
255, 292, 293, 294, 295, 304, 307, 306, 300, 313,
924
246, 314, 319, 328, 315, 318, 320, 317, 330, 283,
925
285, 321, 288, 67, 284, 159, 71, 286, 326, 287,
926
316, 160, 76, 257, 296, 327, 66, 264, 1, 2,
927
82, 83, 84, 85, 86, 87, 183, 88, 89, 90,
928
91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
929
101, 102, 103, 308, 60, 297, 18, 19, 20, 21,
930
104, 22, 23, 24, 25, 26, 27, 105, 106, 107,
931
108, 109, 0, 0, 0, 110, 111, 0, 0, 0,
932
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
933
0, 0, 0, 0, 112, 0, 0, 0, 113, 114,
934
0, 0, 0, 0, 115, 116, 117, 118, 119, 1,
935
2, 82, 83, 84, 85, 86, 87, 0, 88, 89,
936
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
937
100, 101, 102, 103, 0, 0, 0, 18, 19, 20,
938
21, 104, 22, 23, 24, 25, 26, 27, 105, 106,
939
107, 108, 109, 0, 0, 0, 110, 111, 0, 0,
940
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
941
0, 0, 0, 0, 0, 112, 0, 0, 0, 113,
942
248, 0, 0, 0, 0, 115, 116, 117, 118, 119,
943
1, 2, 82, 83, 84, 85, 86, 87, 0, 88,
944
89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
945
99, 100, 101, 102, 103, 0, 0, 0, 18, 19,
946
20, 21, 104, 22, 23, 24, 25, 26, 27, 105,
947
106, 107, 108, 109, 0, 0, 0, 110, 111, 0,
948
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
949
0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
950
113, 0, 0, 0, 0, 0, 115, 116, 117, 118,
951
119, 1, 2, 82, 83, 84, 85, 86, 87, 0,
952
88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
953
98, 99, 100, 101, 102, 103, 0, 0, 0, 18,
954
19, 20, 21, 104, 22, 23, 24, 25, 26, 27,
955
105, 106, 107, 108, 109, 0, 0, 0, 110, 111,
956
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
957
0, 0, 0, 0, 0, 0, 0, 112, 0, 0,
958
0, 65, 1, 2, 82, 83, 84, 115, 116, 117,
959
118, 119, 0, 0, 0, 92, 93, 94, 95, 96,
960
97, 98, 99, 100, 101, 102, 103, 0, 0, 0,
961
18, 19, 20, 21, 0, 22, 23, 24, 25, 26,
962
27, 105, 106, 107, 108, 109, 0, 0, 0, 110,
963
111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
964
0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
965
1, 2, 82, 83, 84, 0, 0, 0, 115, 116,
966
117, 118, 119, 92, 93, 94, 95, 96, 97, 98,
967
99, 100, 101, 102, 103, 0, 0, 0, 18, 19,
968
20, 21, 0, 22, 23, 24, 25, 26, 27, 105,
969
106, 107, 108, 109, 0, 0, 0, 110, 111, 0,
970
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
971
0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
972
163, 164, 165, 0, 0, 0, 0, 116, 117, 118,
973
119, 166, 167, 168, 169, 170, 171, 172, 173, 174,
974
175, 176, 177, 0, 0, 0, 0, 0, 0, 0,
975
0, 0, 0, 0, 0, 0, 0, 105, 178, 107,
976
108, 109, 0, 0, 0, 110, 111, 0, 0, 0,
977
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
978
0, 0, 0, 0, 112, 0, 0, 179, 163, 164,
979
165, 0, 0, 0, 0, 116, 117, 118, 119, 166,
980
167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
981
177, 0, 0, 0, 0, 0, 0, 0, 0, 0,
982
0, 0, 0, 0, 0, 105, 178, 107, 108, 109,
983
0, 0, 0, 110, 111, 0, 0, 0, 0, 0,
984
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
985
0, 0, 112, 0, 0, 0, 163, 164, 165, 0,
986
0, 0, 195, 116, 117, 118, 119, 166, 167, 168,
987
169, 170, 171, 172, 173, 174, 175, 176, 177, 0,
988
0, 0, 0, 0, 0, 210, 0, 0, 0, 0,
989
0, 0, 0, 105, 178, 107, 108, 109, 0, 0,
990
0, 110, 111, 0, 0, 0, 0, 0, 0, 0,
991
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
992
112, 0, 0, 0, 163, 164, 165, 0, 0, 0,
993
0, 116, 117, 118, 119, 166, 167, 168, 169, 170,
994
171, 172, 173, 174, 175, 176, 177, 0, 0, 0,
995
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
996
0, 105, 178, 107, 108, 109, 0, 0, 0, 110,
997
111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
998
0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
999
0, 252, 163, 164, 165, 0, 0, 0, 0, 116,
1000
117, 118, 119, 166, 167, 168, 169, 170, 171, 172,
1001
173, 174, 175, 176, 177, 0, 0, 0, 0, 0,
1002
0, 0, 0, 0, 0, 0, 0, 0, 0, 105,
1003
178, 107, 108, 109, 0, 0, 0, 110, 111, 0,
1004
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1005
0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
1006
3, 4, 5, 0, 0, 0, 0, 116, 117, 118,
1007
119, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1008
15, 16, 17, 0, 0, 0, 0, 0, 20, 21,
1009
0, 22, 23, 24, 25, 26, 27, 0, 28, 3,
1010
4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
1011
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1012
16, 17, 0, 0, 0, 0, 0, 20, 21, 80,
1013
22, 23, 24, 25, 26, 27, 0, 28, 59, 0,
1014
0, 1, 2, 3, 4, 5, 0, 0, 0, 0,
1015
0, 0, 0, 0, 6, 7, 8, 9, 10, 11,
1016
12, 13, 14, 15, 16, 17, 0, 0, 185, 18,
1017
19, 20, 21, 0, 22, 23, 24, 25, 26, 27,
1018
0, 28, 1, 2, 3, 4, 5, 0, 0, 0,
1019
0, 0, 0, 0, 0, 6, 7, 8, 9, 10,
1020
11, 12, 13, 14, 15, 16, 17, 0, 0, 0,
1021
18, 19, 20, 21, 0, 22, 23, 24, 25, 26,
1022
27, 0, 28, 3, 4, 5, 0, 0, 0, 0,
1023
0, 0, 0, 0, 6, 7, 8, 9, 10, 11,
1024
12, 13, 14, 15, 16, 17, 0, 0, 0, 0,
1025
0, 20, 21, 0, 22, 23, 24, 25, 26, 27,
1029
static const short yycheck[] =
1031
75, 91, 162, 158, 37, 262, 161, 3, 4, 0,
1032
0, 44, 52, 53, 33, 42, 57, 74, 314, 71,
1033
53, 74, 112, 319, 42, 81, 78, 83, 61, 48,
1034
63, 186, 28, 29, 30, 31, 32, 79, 71, 3,
1035
4, 298, 70, 76, 76, 152, 73, 87, 88, 40,
1036
40, 92, 127, 71, 71, 50, 51, 110, 111, 63,
1037
69, 42, 71, 73, 28, 29, 30, 31, 32, 78,
1038
73, 70, 76, 70, 70, 42, 71, 76, 131, 76,
1039
75, 42, 70, 70, 191, 48, 49, 162, 76, 76,
1040
233, 234, 235, 236, 76, 250, 76, 79, 69, 79,
1041
79, 158, 79, 193, 161, 158, 76, 76, 161, 79,
1042
79, 28, 29, 30, 69, 205, 59, 60, 61, 62,
1043
63, 64, 65, 66, 67, 68, 84, 85, 86, 186,
1044
54, 55, 69, 186, 209, 78, 76, 77, 229, 230,
1045
237, 238, 231, 232, 69, 79, 69, 69, 69, 224,
1046
69, 69, 91, 69, 69, 245, 69, 264, 69, 69,
1047
69, 321, 69, 69, 69, 69, 69, 56, 70, 69,
1048
90, 246, 262, 226, 227, 228, 229, 230, 231, 232,
1049
233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
1050
243, 244, 299, 250, 74, 89, 58, 250, 71, 47,
1051
72, 72, 72, 72, 35, 72, 69, 72, 298, 42,
1052
76, 70, 70, 320, 74, 79, 11, 307, 79, 239,
1053
241, 78, 244, 48, 240, 71, 54, 242, 318, 243,
1054
305, 71, 61, 187, 259, 319, 46, 202, 3, 4,
1055
5, 6, 7, 8, 9, 10, 321, 12, 13, 14,
1056
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1057
25, 26, 27, 298, 40, 259, 31, 32, 33, 34,
1058
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1059
45, 46, -1, -1, -1, 50, 51, -1, -1, -1,
1060
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1061
-1, -1, -1, -1, 69, -1, -1, -1, 73, 74,
1062
-1, -1, -1, -1, 79, 80, 81, 82, 83, 3,
1063
4, 5, 6, 7, 8, 9, 10, -1, 12, 13,
1064
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1065
24, 25, 26, 27, -1, -1, -1, 31, 32, 33,
1066
34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
1067
44, 45, 46, -1, -1, -1, 50, 51, -1, -1,
1068
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1069
-1, -1, -1, -1, -1, 69, -1, -1, -1, 73,
1070
74, -1, -1, -1, -1, 79, 80, 81, 82, 83,
1071
3, 4, 5, 6, 7, 8, 9, 10, -1, 12,
1072
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1073
23, 24, 25, 26, 27, -1, -1, -1, 31, 32,
1074
33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
1075
43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
1076
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1077
-1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
1078
73, -1, -1, -1, -1, -1, 79, 80, 81, 82,
1079
83, 3, 4, 5, 6, 7, 8, 9, 10, -1,
1080
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1081
22, 23, 24, 25, 26, 27, -1, -1, -1, 31,
1082
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1083
42, 43, 44, 45, 46, -1, -1, -1, 50, 51,
1084
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1085
-1, -1, -1, -1, -1, -1, -1, 69, -1, -1,
1086
-1, 73, 3, 4, 5, 6, 7, 79, 80, 81,
1087
82, 83, -1, -1, -1, 16, 17, 18, 19, 20,
1088
21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
1089
31, 32, 33, 34, -1, 36, 37, 38, 39, 40,
1090
41, 42, 43, 44, 45, 46, -1, -1, -1, 50,
1091
51, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1092
-1, -1, -1, -1, -1, -1, -1, -1, 69, -1,
1093
3, 4, 5, 6, 7, -1, -1, -1, 79, 80,
1094
81, 82, 83, 16, 17, 18, 19, 20, 21, 22,
1095
23, 24, 25, 26, 27, -1, -1, -1, 31, 32,
1096
33, 34, -1, 36, 37, 38, 39, 40, 41, 42,
1097
43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
1098
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1099
-1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
1100
5, 6, 7, -1, -1, -1, -1, 80, 81, 82,
1101
83, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1102
25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
1103
-1, -1, -1, -1, -1, -1, -1, 42, 43, 44,
1104
45, 46, -1, -1, -1, 50, 51, -1, -1, -1,
1105
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1106
-1, -1, -1, -1, 69, -1, -1, 72, 5, 6,
1107
7, -1, -1, -1, -1, 80, 81, 82, 83, 16,
1108
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1109
27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1110
-1, -1, -1, -1, -1, 42, 43, 44, 45, 46,
1111
-1, -1, -1, 50, 51, -1, -1, -1, -1, -1,
1112
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1113
-1, -1, 69, -1, -1, -1, 5, 6, 7, -1,
1114
-1, -1, 79, 80, 81, 82, 83, 16, 17, 18,
1115
19, 20, 21, 22, 23, 24, 25, 26, 27, -1,
1116
-1, -1, -1, -1, -1, 34, -1, -1, -1, -1,
1117
-1, -1, -1, 42, 43, 44, 45, 46, -1, -1,
1118
-1, 50, 51, -1, -1, -1, -1, -1, -1, -1,
1119
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1120
69, -1, -1, -1, 5, 6, 7, -1, -1, -1,
1121
-1, 80, 81, 82, 83, 16, 17, 18, 19, 20,
1122
21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
1123
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1124
-1, 42, 43, 44, 45, 46, -1, -1, -1, 50,
1125
51, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1126
-1, -1, -1, -1, -1, -1, -1, -1, 69, -1,
1127
-1, 72, 5, 6, 7, -1, -1, -1, -1, 80,
1128
81, 82, 83, 16, 17, 18, 19, 20, 21, 22,
1129
23, 24, 25, 26, 27, -1, -1, -1, -1, -1,
1130
-1, -1, -1, -1, -1, -1, -1, -1, -1, 42,
1131
43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
1132
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1133
-1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
1134
5, 6, 7, -1, -1, -1, -1, 80, 81, 82,
1135
83, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1136
25, 26, 27, -1, -1, -1, -1, -1, 33, 34,
1137
-1, 36, 37, 38, 39, 40, 41, -1, 43, 5,
1138
6, 7, -1, -1, -1, -1, -1, -1, -1, -1,
1139
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1140
26, 27, -1, -1, -1, -1, -1, 33, 34, 74,
1141
36, 37, 38, 39, 40, 41, -1, 43, 0, -1,
1142
-1, 3, 4, 5, 6, 7, -1, -1, -1, -1,
1143
-1, -1, -1, -1, 16, 17, 18, 19, 20, 21,
1144
22, 23, 24, 25, 26, 27, -1, -1, 74, 31,
1145
32, 33, 34, -1, 36, 37, 38, 39, 40, 41,
1146
-1, 43, 3, 4, 5, 6, 7, -1, -1, -1,
1147
-1, -1, -1, -1, -1, 16, 17, 18, 19, 20,
1148
21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
1149
31, 32, 33, 34, -1, 36, 37, 38, 39, 40,
1150
41, -1, 43, 5, 6, 7, -1, -1, -1, -1,
1151
-1, -1, -1, -1, 16, 17, 18, 19, 20, 21,
1152
22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
1153
-1, 33, 34, -1, 36, 37, 38, 39, 40, 41,
1157
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1158
symbol of state STATE-NUM. */
1159
static const unsigned char yystos[] =
1161
0, 3, 4, 5, 6, 7, 16, 17, 18, 19,
1162
20, 21, 22, 23, 24, 25, 26, 27, 31, 32,
1163
33, 34, 36, 37, 38, 39, 40, 41, 43, 123,
1164
124, 125, 126, 127, 132, 133, 134, 135, 136, 137,
1165
164, 165, 166, 42, 73, 79, 167, 70, 76, 28,
1166
29, 30, 129, 130, 135, 76, 79, 42, 136, 0,
1167
165, 73, 136, 138, 139, 73, 150, 129, 128, 131,
1168
136, 130, 42, 69, 71, 78, 138, 42, 140, 141,
1169
74, 139, 5, 6, 7, 8, 9, 10, 12, 13,
1170
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1171
24, 25, 26, 27, 35, 42, 43, 44, 45, 46,
1172
50, 51, 69, 73, 74, 79, 80, 81, 82, 83,
1173
94, 95, 96, 98, 99, 100, 101, 102, 103, 104,
1174
105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1175
115, 116, 117, 118, 119, 121, 123, 124, 143, 144,
1176
145, 146, 151, 152, 153, 156, 163, 42, 71, 128,
1177
131, 71, 78, 5, 6, 7, 16, 17, 18, 19,
1178
20, 21, 22, 23, 24, 25, 26, 27, 43, 72,
1179
105, 118, 122, 119, 142, 74, 71, 76, 79, 79,
1180
79, 158, 69, 69, 79, 79, 121, 69, 105, 105,
1181
121, 74, 147, 50, 51, 71, 75, 70, 70, 76,
1182
34, 119, 69, 59, 60, 61, 62, 63, 64, 65,
1183
66, 67, 68, 78, 120, 105, 84, 85, 86, 81,
1184
83, 48, 49, 52, 53, 87, 88, 54, 55, 91,
1185
90, 89, 56, 58, 57, 92, 76, 79, 74, 144,
1186
71, 122, 72, 122, 142, 72, 122, 141, 144, 159,
1187
121, 79, 157, 70, 151, 97, 121, 47, 119, 119,
1188
105, 105, 105, 107, 107, 108, 108, 109, 109, 109,
1189
109, 110, 110, 111, 112, 113, 114, 115, 116, 121,
1190
119, 122, 72, 72, 72, 35, 143, 152, 160, 70,
1191
121, 134, 155, 148, 72, 77, 72, 69, 155, 161,
1192
162, 144, 154, 42, 70, 74, 119, 121, 79, 70,
1193
11, 78, 145, 149, 150, 70, 121, 149, 144, 142,
1197
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1198
# define YYSIZE_T __SIZE_TYPE__
1200
#if ! defined (YYSIZE_T) && defined (size_t)
1201
# define YYSIZE_T size_t
1203
#if ! defined (YYSIZE_T)
1204
# if defined (__STDC__) || defined (__cplusplus)
1205
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1206
# define YYSIZE_T size_t
1209
#if ! defined (YYSIZE_T)
1210
# define YYSIZE_T unsigned int
1213
#define yyerrok (yyerrstatus = 0)
1214
#define yyclearin (yychar = YYEMPTY)
1215
#define YYEMPTY (-2)
1218
#define YYACCEPT goto yyacceptlab
1219
#define YYABORT goto yyabortlab
1220
#define YYERROR goto yyerrlab1
1223
/* Like YYERROR except do call yyerror. This remains here temporarily
1224
to ease the transition to the new meaning of YYERROR, for GCC.
1225
Once GCC version 2 has supplanted version 1, this can go. */
1227
#define YYFAIL goto yyerrlab
1229
#define YYRECOVERING() (!!yyerrstatus)
1231
#define YYBACKUP(Token, Value) \
1233
if (yychar == YYEMPTY && yylen == 1) \
1237
yytoken = YYTRANSLATE (yychar); \
1243
yyerror ("syntax error: cannot back up");\
1249
#define YYERRCODE 256
1251
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
1254
#ifndef YYLLOC_DEFAULT
1255
# define YYLLOC_DEFAULT(Current, Rhs, N) \
1256
Current.first_line = Rhs[1].first_line; \
1257
Current.first_column = Rhs[1].first_column; \
1258
Current.last_line = Rhs[N].last_line; \
1259
Current.last_column = Rhs[N].last_column;
1262
/* YYLEX -- calling `yylex' with the right arguments. */
1265
# define YYLEX yylex (&yylval, YYLEX_PARAM)
1267
# define YYLEX yylex (&yylval)
1270
/* Enable debugging if requested. */
1274
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1275
# define YYFPRINTF fprintf
1278
# define YYDPRINTF(Args) \
1284
# define YYDSYMPRINT(Args) \
1290
# define YYDSYMPRINTF(Title, Token, Value, Location) \
1294
YYFPRINTF (stderr, "%s ", Title); \
1295
yysymprint (stderr, \
1297
YYFPRINTF (stderr, "\n"); \
1301
/*------------------------------------------------------------------.
1302
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1304
`------------------------------------------------------------------*/
1306
#if defined (__STDC__) || defined (__cplusplus)
1308
yy_stack_print (short *bottom, short *top)
1311
yy_stack_print (bottom, top)
1316
YYFPRINTF (stderr, "Stack now");
1317
for (/* Nothing. */; bottom <= top; ++bottom)
1318
YYFPRINTF (stderr, " %d", *bottom);
1319
YYFPRINTF (stderr, "\n");
1322
# define YY_STACK_PRINT(Bottom, Top) \
1325
yy_stack_print ((Bottom), (Top)); \
1329
/*------------------------------------------------.
1330
| Report that the YYRULE is going to be reduced. |
1331
`------------------------------------------------*/
1333
#if defined (__STDC__) || defined (__cplusplus)
1335
yy_reduce_print (int yyrule)
1338
yy_reduce_print (yyrule)
1343
unsigned int yylineno = yyrline[yyrule];
1344
YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1345
yyrule - 1, yylineno);
1346
/* Print the symbols being reduced, and their result. */
1347
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1348
YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1349
YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1352
# define YY_REDUCE_PRINT(Rule) \
1355
yy_reduce_print (Rule); \
1358
/* Nonzero means print parse trace. It is left uninitialized so that
1359
multiple parsers can coexist. */
1361
#else /* !YYDEBUG */
1362
# define YYDPRINTF(Args)
1363
# define YYDSYMPRINT(Args)
1364
# define YYDSYMPRINTF(Title, Token, Value, Location)
1365
# define YY_STACK_PRINT(Bottom, Top)
1366
# define YY_REDUCE_PRINT(Rule)
1367
#endif /* !YYDEBUG */
1370
/* YYINITDEPTH -- initial size of the parser's stacks. */
1372
# define YYINITDEPTH 200
1375
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1376
if the built-in stack extension method is used).
1378
Do not make this value too large; the results are undefined if
1379
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1380
evaluated with infinite-precision integer arithmetic. */
1387
# define YYMAXDEPTH 10000
1395
# if defined (__GLIBC__) && defined (_STRING_H)
1396
# define yystrlen strlen
1398
/* Return the length of YYSTR. */
1400
# if defined (__STDC__) || defined (__cplusplus)
1401
yystrlen (const char *yystr)
1407
register const char *yys = yystr;
1409
while (*yys++ != '\0')
1412
return yys - yystr - 1;
1418
# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1419
# define yystpcpy stpcpy
1421
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1424
# if defined (__STDC__) || defined (__cplusplus)
1425
yystpcpy (char *yydest, const char *yysrc)
1427
yystpcpy (yydest, yysrc)
1432
register char *yyd = yydest;
1433
register const char *yys = yysrc;
1435
while ((*yyd++ = *yys++) != '\0')
1443
#endif /* !YYERROR_VERBOSE */
1448
/*--------------------------------.
1449
| Print this symbol on YYOUTPUT. |
1450
`--------------------------------*/
1452
#if defined (__STDC__) || defined (__cplusplus)
1454
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1457
yysymprint (yyoutput, yytype, yyvaluep)
1463
/* Pacify ``unused variable'' warnings. */
1466
if (yytype < YYNTOKENS)
1468
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1470
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1474
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1481
YYFPRINTF (yyoutput, ")");
1484
#endif /* ! YYDEBUG */
1485
/*-----------------------------------------------.
1486
| Release the memory associated to this symbol. |
1487
`-----------------------------------------------*/
1489
#if defined (__STDC__) || defined (__cplusplus)
1491
yydestruct (int yytype, YYSTYPE *yyvaluep)
1494
yydestruct (yytype, yyvaluep)
1499
/* Pacify ``unused variable'' warnings. */
1511
/* Prevent warnings from -Wmissing-prototypes. */
1513
#ifdef YYPARSE_PARAM
1514
# if defined (__STDC__) || defined (__cplusplus)
1515
int yyparse (void *YYPARSE_PARAM);
1519
#else /* ! YYPARSE_PARAM */
1520
#if defined (__STDC__) || defined (__cplusplus)
1525
#endif /* ! YYPARSE_PARAM */
1536
#ifdef YYPARSE_PARAM
1537
# if defined (__STDC__) || defined (__cplusplus)
1538
int yyparse (void *YYPARSE_PARAM)
1540
int yyparse (YYPARSE_PARAM)
1541
void *YYPARSE_PARAM;
1543
#else /* ! YYPARSE_PARAM */
1544
#if defined (__STDC__) || defined (__cplusplus)
1554
/* The lookahead symbol. */
1557
/* The semantic value of the lookahead symbol. */
1560
/* Number of syntax errors so far. */
1563
register int yystate;
1566
/* Number of tokens to shift before error messages enabled. */
1568
/* Lookahead token as an internal (translated) token number. */
1571
/* Three stacks and their tools:
1572
`yyss': related to states,
1573
`yyvs': related to semantic values,
1574
`yyls': related to locations.
1576
Refer to the stacks thru separate pointers, to allow yyoverflow
1577
to reallocate them elsewhere. */
1579
/* The state stack. */
1580
short yyssa[YYINITDEPTH];
1581
short *yyss = yyssa;
1582
register short *yyssp;
1584
/* The semantic value stack. */
1585
YYSTYPE yyvsa[YYINITDEPTH];
1586
YYSTYPE *yyvs = yyvsa;
1587
register YYSTYPE *yyvsp;
1591
#define YYPOPSTACK (yyvsp--, yyssp--)
1593
YYSIZE_T yystacksize = YYINITDEPTH;
1595
/* The variables used to return semantic value and location from the
1600
/* When reducing, the number of symbols on the RHS of the reduced
1604
YYDPRINTF ((stderr, "Starting parse\n"));
1609
yychar = YYEMPTY; /* Cause a token to be read. */
1611
/* Initialize stack pointers.
1612
Waste one element of value and location stack
1613
so that they stay on the same level as the state stack.
1614
The wasted elements are never initialized. */
1621
/*------------------------------------------------------------.
1622
| yynewstate -- Push a new state, which is found in yystate. |
1623
`------------------------------------------------------------*/
1625
/* In all cases, when you get here, the value and location stacks
1626
have just been pushed. so pushing a state here evens the stacks.
1633
if (yyss + yystacksize - 1 <= yyssp)
1635
/* Get the current used size of the three stacks, in elements. */
1636
YYSIZE_T yysize = yyssp - yyss + 1;
1640
/* Give user a chance to reallocate the stack. Use copies of
1641
these so that the &'s don't force the real ones into
1643
YYSTYPE *yyvs1 = yyvs;
1644
short *yyss1 = yyss;
1647
/* Each stack pointer address is followed by the size of the
1648
data in use in that stack, in bytes. This used to be a
1649
conditional around just the two extra args, but that might
1650
be undefined if yyoverflow is a macro. */
1651
yyoverflow ("parser stack overflow",
1652
&yyss1, yysize * sizeof (*yyssp),
1653
&yyvs1, yysize * sizeof (*yyvsp),
1660
#else /* no yyoverflow */
1661
# ifndef YYSTACK_RELOCATE
1664
/* Extend the stack our own way. */
1665
if (YYMAXDEPTH <= yystacksize)
1668
if (YYMAXDEPTH < yystacksize)
1669
yystacksize = YYMAXDEPTH;
1672
short *yyss1 = yyss;
1673
union yyalloc *yyptr =
1674
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1677
YYSTACK_RELOCATE (yyss);
1678
YYSTACK_RELOCATE (yyvs);
1680
# undef YYSTACK_RELOCATE
1682
YYSTACK_FREE (yyss1);
1685
#endif /* no yyoverflow */
1687
yyssp = yyss + yysize - 1;
1688
yyvsp = yyvs + yysize - 1;
1691
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1692
(unsigned long int) yystacksize));
1694
if (yyss + yystacksize - 1 <= yyssp)
1698
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1707
/* Do appropriate processing given the current state. */
1708
/* Read a lookahead token if we need one and don't already have one. */
1711
/* First try to decide what to do without reference to lookahead token. */
1713
yyn = yypact[yystate];
1714
if (yyn == YYPACT_NINF)
1717
/* Not known => get a lookahead token if don't already have one. */
1719
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1720
if (yychar == YYEMPTY)
1722
YYDPRINTF ((stderr, "Reading a token: "));
1726
if (yychar <= YYEOF)
1728
yychar = yytoken = YYEOF;
1729
YYDPRINTF ((stderr, "Now at end of input.\n"));
1733
yytoken = YYTRANSLATE (yychar);
1734
YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1737
/* If the proper action on seeing token YYTOKEN is to reduce or to
1738
detect an error, take that action. */
1740
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1745
if (yyn == 0 || yyn == YYTABLE_NINF)
1754
/* Shift the lookahead token. */
1755
YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1757
/* Discard the token being shifted unless it is eof. */
1758
if (yychar != YYEOF)
1764
/* Count tokens shifted since error; after three, turn off error
1773
/*-----------------------------------------------------------.
1774
| yydefault -- do the default action for the current state. |
1775
`-----------------------------------------------------------*/
1777
yyn = yydefact[yystate];
1783
/*-----------------------------.
1784
| yyreduce -- Do a reduction. |
1785
`-----------------------------*/
1787
/* yyn is the number of a rule to reduce with. */
1790
/* If YYLEN is nonzero, implement the default value of the action:
1793
Otherwise, the following line sets YYVAL to garbage.
1794
This behavior is undocumented and Bison
1795
users should not rely upon it. Assigning to YYVAL
1796
unconditionally makes the parser a bit smaller, and it avoids a
1797
GCC warning that YYVAL may be used uninitialized. */
1798
yyval = yyvsp[1-yylen];
1801
YY_REDUCE_PRINT (yyn);
1805
#line 210 "glslang.y"
1807
// The symbol table search was done in the lexical phase
1808
const TSymbol* symbol = yyvsp[0].lex.symbol;
1809
const TVariable* variable;
1811
parseContext.error(yyvsp[0].lex.line, "undeclared identifier", yyvsp[0].lex.string->c_str(), "");
1812
parseContext.recover();
1813
TType type(EbtFloat);
1814
TVariable* fakeVariable = new TVariable(yyvsp[0].lex.string, type);
1815
parseContext.symbolTable.insert(*fakeVariable);
1816
variable = fakeVariable;
1818
// This identifier can only be a variable type symbol
1819
if (! symbol->isVariable()) {
1820
parseContext.error(yyvsp[0].lex.line, "variable expected", yyvsp[0].lex.string->c_str(), "");
1821
parseContext.recover();
1823
variable = static_cast<const TVariable*>(symbol);
1826
// don't delete $1.string, it's used by error recovery, and the pool
1827
// pop will reclaim the memory
1829
if (variable->getType().getQualifier() == EvqConst ) {
1830
constUnion* constArray = variable->getConstPointer();
1831
TType t(variable->getType());
1832
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(constArray, t, yyvsp[0].lex.line);
1834
yyval.interm.intermTypedNode = parseContext.intermediate.addSymbol(variable->getUniqueId(),
1835
variable->getName(),
1836
variable->getType(), yyvsp[0].lex.line);
1841
#line 245 "glslang.y"
1843
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
1848
#line 248 "glslang.y"
1851
// INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
1852
// check for overflow for constants
1854
if (abs(yyvsp[0].lex.i) >= (1 << 16)) {
1855
parseContext.error(yyvsp[0].lex.line, " integer constant overflow", "", "");
1856
parseContext.recover();
1858
constUnion *unionArray = new constUnion[1];
1859
unionArray->iConst = yyvsp[0].lex.i;
1860
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
1865
#line 261 "glslang.y"
1867
constUnion *unionArray = new constUnion[1];
1868
unionArray->fConst = yyvsp[0].lex.f;
1869
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].lex.line);
1874
#line 266 "glslang.y"
1876
constUnion *unionArray = new constUnion[1];
1877
unionArray->bConst = yyvsp[0].lex.b;
1878
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[0].lex.line);
1883
#line 271 "glslang.y"
1885
yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
1890
#line 277 "glslang.y"
1892
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
1897
#line 280 "glslang.y"
1899
if (!yyvsp[-3].interm.intermTypedNode->isArray() && !yyvsp[-3].interm.intermTypedNode->isMatrix() && !yyvsp[-3].interm.intermTypedNode->isVector()) {
1900
if (yyvsp[-3].interm.intermTypedNode->getAsSymbolNode())
1901
parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", yyvsp[-3].interm.intermTypedNode->getAsSymbolNode()->getSymbol().c_str(), "");
1903
parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
1904
parseContext.recover();
1906
if (yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst && !yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) {
1907
if (yyvsp[-3].interm.intermTypedNode->isVector()) { // constant folding for vectors
1908
TVectorFields fields;
1910
fields.offsets[0] = yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst; // need to do it this way because v.xy sends fields integer array
1911
yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);
1912
} else if (yyvsp[-3].interm.intermTypedNode->isMatrix()) { // constant folding for matrices
1913
yyval.interm.intermTypedNode = parseContext.addConstMatrixNode(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);
1916
if (yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) {
1917
if ((yyvsp[-3].interm.intermTypedNode->isVector() || yyvsp[-3].interm.intermTypedNode->isMatrix()) && yyvsp[-3].interm.intermTypedNode->getType().getNominalSize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst && !yyvsp[-3].interm.intermTypedNode->isArray() ) {
1918
parseContext.error(yyvsp[-2].lex.line, "", "[", "field selection out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
1919
parseContext.recover();
1921
if (yyvsp[-3].interm.intermTypedNode->isArray()) {
1922
if (yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) {
1923
if (yyvsp[-3].interm.intermTypedNode->getType().getMaxArraySize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst) {
1924
if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, true, yyvsp[-2].lex.line))
1925
parseContext.recover();
1927
if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), 0, false, yyvsp[-2].lex.line))
1928
parseContext.recover();
1930
} else if ( yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst >= yyvsp[-3].interm.intermTypedNode->getType().getArraySize()) {
1931
parseContext.error(yyvsp[-2].lex.line, "", "[", "array index out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
1932
parseContext.recover();
1935
yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
1938
if (yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) {
1939
parseContext.error(yyvsp[-2].lex.line, "", "[", "array must be redeclared with a size before being indexed with a variable");
1940
parseContext.recover();
1943
yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexIndirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
1946
if (yyval.interm.intermTypedNode == 0) {
1947
constUnion *unionArray = new constUnion[1];
1948
unionArray->fConst = 0.0;
1949
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[-2].lex.line);
1950
} else if (yyvsp[-3].interm.intermTypedNode->isArray()) {
1951
if (yyvsp[-3].interm.intermTypedNode->getType().getStruct())
1952
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getType().getStruct(), yyvsp[-3].interm.intermTypedNode->getType().getTypeName()));
1954
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize(), yyvsp[-3].interm.intermTypedNode->isMatrix()));
1955
} else if (yyvsp[-3].interm.intermTypedNode->isMatrix() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst)
1956
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst, yyvsp[-3].interm.intermTypedNode->getNominalSize()));
1957
else if (yyvsp[-3].interm.intermTypedNode->isMatrix())
1958
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize()));
1959
else if (yyvsp[-3].interm.intermTypedNode->isVector() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst)
1960
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst));
1961
else if (yyvsp[-3].interm.intermTypedNode->isVector())
1962
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary));
1964
yyval.interm.intermTypedNode->setType(yyvsp[-3].interm.intermTypedNode->getType());
1969
#line 348 "glslang.y"
1971
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
1976
#line 351 "glslang.y"
1978
if (yyvsp[-2].interm.intermTypedNode->isArray()) {
1979
parseContext.error(yyvsp[0].lex.line, "cannot apply dot operator to an array", ".", "");
1980
parseContext.recover();
1983
if (yyvsp[-2].interm.intermTypedNode->isVector()) {
1984
TVectorFields fields;
1985
if (! parseContext.parseVectorFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) {
1987
fields.offsets[0] = 0;
1988
parseContext.recover();
1991
if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) { // constant folding for vector fields
1992
yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-2].interm.intermTypedNode, yyvsp[0].lex.line);
1993
if (yyval.interm.intermTypedNode == 0) {
1994
parseContext.recover();
1995
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
1998
yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqConst, (int) (*yyvsp[0].lex.string).size()));
2000
if (fields.num == 1) {
2001
constUnion *unionArray = new constUnion[1];
2002
unionArray->iConst = fields.offsets[0];
2003
TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
2004
yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
2005
yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType()));
2007
TString vectorString = *yyvsp[0].lex.string;
2008
TIntermTyped* index = parseContext.intermediate.addSwizzle(fields, yyvsp[0].lex.line);
2009
yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpVectorSwizzle, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
2010
yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(),EvqTemporary, (int) vectorString.size()));
2013
} else if (yyvsp[-2].interm.intermTypedNode->isMatrix()) {
2014
TMatrixFields fields;
2015
if (! parseContext.parseMatrixFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) {
2016
fields.wholeRow = false;
2017
fields.wholeCol = false;
2020
parseContext.recover();
2023
if (fields.wholeRow || fields.wholeCol) {
2024
parseContext.error(yyvsp[-1].lex.line, " non-scalar fields not implemented yet", ".", "");
2025
parseContext.recover();
2026
constUnion *unionArray = new constUnion[1];
2027
unionArray->iConst = 0;
2028
TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
2029
yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
2030
yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-2].interm.intermTypedNode->getNominalSize()));
2032
constUnion *unionArray = new constUnion[1];
2033
unionArray->iConst = fields.col * yyvsp[-2].interm.intermTypedNode->getNominalSize() + fields.row;
2034
TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
2035
yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
2036
yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType()));
2038
} else if (yyvsp[-2].interm.intermTypedNode->getBasicType() == EbtStruct) {
2039
bool fieldFound = false;
2040
TTypeList* fields = yyvsp[-2].interm.intermTypedNode->getType().getStruct();
2042
parseContext.error(yyvsp[-1].lex.line, "structure has no fields", "Internal Error", "");
2043
parseContext.recover();
2044
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2047
for (i = 0; i < fields->size(); ++i) {
2048
if ((*fields)[i].type->getFieldName() == *yyvsp[0].lex.string) {
2054
if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) {
2055
yyval.interm.intermTypedNode = parseContext.addConstStruct(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode, yyvsp[-1].lex.line);
2056
if (yyval.interm.intermTypedNode == 0) {
2057
parseContext.recover();
2058
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2061
yyval.interm.intermTypedNode->setType(*(*fields)[i].type);
2062
// change the qualifier of the return type, not of the structure field
2063
// as the structure definition is shared between various structures.
2064
yyval.interm.intermTypedNode->getTypePointer()->changeQualifier(EvqConst);
2067
constUnion *unionArray = new constUnion[1];
2068
unionArray->iConst = i;
2069
TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
2070
yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirectStruct, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
2071
yyval.interm.intermTypedNode->setType(*(*fields)[i].type);
2074
parseContext.error(yyvsp[-1].lex.line, " no such field in structure", yyvsp[0].lex.string->c_str(), "");
2075
parseContext.recover();
2076
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2080
parseContext.error(yyvsp[-1].lex.line, " field selection requires structure, vector, or matrix on left hand side", yyvsp[0].lex.string->c_str(), "");
2081
parseContext.recover();
2082
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2084
// don't delete $3.string, it's from the pool
2089
#line 460 "glslang.y"
2091
if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode))
2092
parseContext.recover();
2093
yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostIncrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable);
2094
if (yyval.interm.intermTypedNode == 0) {
2095
parseContext.unaryOpError(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode->getCompleteString());
2096
parseContext.recover();
2097
yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
2103
#line 470 "glslang.y"
2105
if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode))
2106
parseContext.recover();
2107
yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostDecrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable);
2108
if (yyval.interm.intermTypedNode == 0) {
2109
parseContext.unaryOpError(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode->getCompleteString());
2110
parseContext.recover();
2111
yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
2117
#line 483 "glslang.y"
2119
if (parseContext.integerErrorCheck(yyvsp[0].interm.intermTypedNode, "[]"))
2120
parseContext.recover();
2121
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2126
#line 491 "glslang.y"
2128
TFunction* fnCall = yyvsp[0].interm.function;
2129
TOperator op = fnCall->getBuiltInOp();
2131
if (op != EOpNull) {
2133
// Then this should be a constructor.
2135
TType type(EbtVoid); // use this to get the type back
2136
if (parseContext.constructorErrorCheck(yyvsp[0].interm.line, yyvsp[0].interm.intermNode, *fnCall, op, &type)) {
2137
yyval.interm.intermTypedNode = 0;
2140
// It's a constructor, of type 'type'.
2142
yyval.interm.intermTypedNode = parseContext.addConstructor(yyvsp[0].interm.intermNode, &type, op, fnCall, yyvsp[0].interm.line);
2145
if (yyval.interm.intermTypedNode == 0) {
2146
parseContext.recover();
2147
yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(0, op, yyvsp[0].interm.line);
2149
yyval.interm.intermTypedNode->setType(type);
2152
// Not a constructor. Find it in the symbol table.
2154
const TFunction* fnCandidate;
2156
fnCandidate = parseContext.findFunction(yyvsp[0].interm.line, fnCall, &builtIn);
2159
// A declared function. But, it might still map to a built-in
2162
op = fnCandidate->getBuiltInOp();
2163
if (builtIn && op != EOpNull) {
2165
// A function call mapped to a built-in operation.
2167
if (fnCandidate->getParamCount() == 1) {
2169
// Treat it like a built-in unary operator.
2171
yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(op, yyvsp[0].interm.intermNode, 0, parseContext.symbolTable);
2172
if (yyval.interm.intermTypedNode == 0) {
2173
parseContext.error(yyvsp[0].interm.intermNode->getLine(), " wrong operand type", "Internal Error",
2174
"built in unary operator function. Type: %s",
2175
static_cast<TIntermTyped*>(yyvsp[0].interm.intermNode)->getCompleteString().c_str());
2179
yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, op, yyvsp[0].interm.line);
2182
// This is a real function call
2184
yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, EOpFunctionCall, yyvsp[0].interm.line);
2185
yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType());
2187
// this is how we know whether the given function is a builtIn function or a user defined function
2188
// if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2189
// if builtIn == true, it's definitely a builtIn function with EOpNull
2191
yyval.interm.intermTypedNode->getAsAggregate()->setUserDefined();
2192
yyval.interm.intermTypedNode->getAsAggregate()->setName(fnCandidate->getMangledName());
2195
TQualifierList& qualifierList = yyval.interm.intermTypedNode->getAsAggregate()->getQualifier();
2196
for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2197
qual = (*fnCandidate)[i].type->getQualifier();
2198
if (qual == EvqOut || qual == EvqInOut) {
2199
if (parseContext.lValueErrorCheck(yyval.interm.intermTypedNode->getLine(), "assign", yyval.interm.intermTypedNode->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2200
parseContext.error(yyvsp[0].interm.intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2201
parseContext.recover();
2204
qualifierList.push_back(qual);
2207
yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType());
2209
// error message was put out by PaFindFunction()
2210
// Put on a dummy node for error recovery
2211
constUnion *unionArray = new constUnion[1];
2212
unionArray->fConst = 0.0;
2213
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].interm.line);
2214
parseContext.recover();
2222
#line 586 "glslang.y"
2224
yyval.interm = yyvsp[-1].interm;
2225
yyval.interm.line = yyvsp[0].lex.line;
2230
#line 590 "glslang.y"
2232
yyval.interm = yyvsp[-1].interm;
2233
yyval.interm.line = yyvsp[0].lex.line;
2238
#line 597 "glslang.y"
2240
yyval.interm.function = yyvsp[-1].interm.function;
2241
yyval.interm.intermNode = 0;
2246
#line 601 "glslang.y"
2248
yyval.interm.function = yyvsp[0].interm.function;
2249
yyval.interm.intermNode = 0;
2254
#line 608 "glslang.y"
2256
TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) };
2257
yyvsp[-1].interm.function->addParameter(param);
2258
yyval.interm.function = yyvsp[-1].interm.function;
2259
yyval.interm.intermNode = yyvsp[0].interm.intermTypedNode;
2264
#line 614 "glslang.y"
2266
TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) };
2267
yyvsp[-2].interm.function->addParameter(param);
2268
yyval.interm.function = yyvsp[-2].interm.function;
2269
yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);
2274
#line 623 "glslang.y"
2276
yyval.interm.function = yyvsp[-1].interm.function;
2281
#line 629 "glslang.y"
2283
if (yyvsp[0].interm.op == EOpConstructStruct) {
2284
TString tempString = "";
2285
TFunction *function = new TFunction(&tempString, *(yyvsp[0].interm.type.userDef), yyvsp[0].interm.op);
2286
yyval.interm.function = function;
2289
TFunction *function = new TFunction(yyvsp[0].interm.op);
2290
yyval.interm.function = function;
2296
#line 640 "glslang.y"
2298
if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
2299
parseContext.recover();
2300
TType type(EbtVoid);
2301
TFunction *function = new TFunction(yyvsp[0].lex.string, type);
2302
yyval.interm.function = function;
2307
#line 656 "glslang.y"
2308
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructFloat; ;}
2312
#line 657 "glslang.y"
2313
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructInt; ;}
2317
#line 658 "glslang.y"
2318
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBool; ;}
2322
#line 659 "glslang.y"
2323
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec2; ;}
2327
#line 660 "glslang.y"
2328
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec3; ;}
2332
#line 661 "glslang.y"
2333
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec4; ;}
2337
#line 662 "glslang.y"
2338
{ FRAG_VERT_ONLY("bvec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec2; ;}
2342
#line 663 "glslang.y"
2343
{ FRAG_VERT_ONLY("bvec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec3; ;}
2347
#line 664 "glslang.y"
2348
{ FRAG_VERT_ONLY("bvec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec4; ;}
2352
#line 665 "glslang.y"
2353
{ FRAG_VERT_ONLY("ivec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec2; ;}
2357
#line 666 "glslang.y"
2358
{ FRAG_VERT_ONLY("ivec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec3; ;}
2362
#line 667 "glslang.y"
2363
{ FRAG_VERT_ONLY("ivec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec4; ;}
2367
#line 668 "glslang.y"
2368
{ FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat2; ;}
2372
#line 669 "glslang.y"
2373
{ FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat3; ;}
2377
#line 670 "glslang.y"
2378
{ FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat4; ;}
2382
#line 671 "glslang.y"
2384
TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();
2385
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
2386
TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line };
2387
yyval.interm.type = t;
2388
yyval.interm.line = yyvsp[0].lex.line;
2389
yyval.interm.op = EOpConstructStruct;
2394
#line 682 "glslang.y"
2396
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2401
#line 685 "glslang.y"
2403
if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode))
2404
parseContext.recover();
2405
yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreIncrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2406
if (yyval.interm.intermTypedNode == 0) {
2407
parseContext.unaryOpError(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode->getCompleteString());
2408
parseContext.recover();
2409
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2415
#line 695 "glslang.y"
2417
if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode))
2418
parseContext.recover();
2419
yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreDecrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2420
if (yyval.interm.intermTypedNode == 0) {
2421
parseContext.unaryOpError(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode->getCompleteString());
2422
parseContext.recover();
2423
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2429
#line 705 "glslang.y"
2431
if (yyvsp[-1].interm.op != EOpNull) {
2432
yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(yyvsp[-1].interm.op, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line, parseContext.symbolTable);
2433
if (yyval.interm.intermTypedNode == 0) {
2435
switch(yyvsp[-1].interm.op) {
2436
case EOpNegative: errorOp = "-"; break;
2437
case EOpLogicalNot: errorOp = "!"; break;
2438
case EOpBitwiseNot: errorOp = "~"; break;
2441
parseContext.unaryOpError(yyvsp[-1].interm.line, errorOp, yyvsp[0].interm.intermTypedNode->getCompleteString());
2442
parseContext.recover();
2443
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2446
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2451
#line 727 "glslang.y"
2452
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNull; ;}
2456
#line 728 "glslang.y"
2457
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNegative; ;}
2461
#line 729 "glslang.y"
2462
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLogicalNot; ;}
2466
#line 730 "glslang.y"
2467
{ PACK_UNPACK_ONLY("~", yyvsp[0].lex.line);
2468
yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpBitwiseNot; ;}
2472
#line 736 "glslang.y"
2473
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2477
#line 737 "glslang.y"
2479
FRAG_VERT_ONLY("*", yyvsp[-1].lex.line);
2480
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMul, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2481
if (yyval.interm.intermTypedNode == 0) {
2482
parseContext.binaryOpError(yyvsp[-1].lex.line, "*", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2483
parseContext.recover();
2484
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2490
#line 746 "glslang.y"
2492
FRAG_VERT_ONLY("/", yyvsp[-1].lex.line);
2493
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpDiv, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2494
if (yyval.interm.intermTypedNode == 0) {
2495
parseContext.binaryOpError(yyvsp[-1].lex.line, "/", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2496
parseContext.recover();
2497
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2503
#line 755 "glslang.y"
2505
PACK_UNPACK_ONLY("%", yyvsp[-1].lex.line);
2506
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMod, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2507
if (yyval.interm.intermTypedNode == 0) {
2508
parseContext.binaryOpError(yyvsp[-1].lex.line, "%", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2509
parseContext.recover();
2510
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2516
#line 767 "glslang.y"
2517
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2521
#line 768 "glslang.y"
2523
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAdd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2524
if (yyval.interm.intermTypedNode == 0) {
2525
parseContext.binaryOpError(yyvsp[-1].lex.line, "+", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2526
parseContext.recover();
2527
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2533
#line 776 "glslang.y"
2535
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpSub, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2536
if (yyval.interm.intermTypedNode == 0) {
2537
parseContext.binaryOpError(yyvsp[-1].lex.line, "-", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2538
parseContext.recover();
2539
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2545
#line 787 "glslang.y"
2546
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2550
#line 788 "glslang.y"
2552
PACK_UNPACK_ONLY("<<", yyvsp[-1].lex.line);
2553
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLeftShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2554
if (yyval.interm.intermTypedNode == 0) {
2555
parseContext.binaryOpError(yyvsp[-1].lex.line, "<<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2556
parseContext.recover();
2557
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2563
#line 797 "glslang.y"
2565
PACK_UNPACK_ONLY(">>", yyvsp[-1].lex.line);
2566
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpRightShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2567
if (yyval.interm.intermTypedNode == 0) {
2568
parseContext.binaryOpError(yyvsp[-1].lex.line, ">>", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2569
parseContext.recover();
2570
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2576
#line 809 "glslang.y"
2577
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2581
#line 810 "glslang.y"
2583
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2584
if (yyval.interm.intermTypedNode == 0) {
2585
parseContext.binaryOpError(yyvsp[-1].lex.line, "<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2586
parseContext.recover();
2587
constUnion *unionArray = new constUnion[1];
2588
unionArray->bConst = false;
2589
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2595
#line 820 "glslang.y"
2597
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2598
if (yyval.interm.intermTypedNode == 0) {
2599
parseContext.binaryOpError(yyvsp[-1].lex.line, ">", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2600
parseContext.recover();
2601
constUnion *unionArray = new constUnion[1];
2602
unionArray->bConst = false;
2603
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2609
#line 830 "glslang.y"
2611
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2612
if (yyval.interm.intermTypedNode == 0) {
2613
parseContext.binaryOpError(yyvsp[-1].lex.line, "<=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2614
parseContext.recover();
2615
constUnion *unionArray = new constUnion[1];
2616
unionArray->bConst = false;
2617
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2623
#line 840 "glslang.y"
2625
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2626
if (yyval.interm.intermTypedNode == 0) {
2627
parseContext.binaryOpError(yyvsp[-1].lex.line, ">=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2628
parseContext.recover();
2629
constUnion *unionArray = new constUnion[1];
2630
unionArray->bConst = false;
2631
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2637
#line 853 "glslang.y"
2638
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2642
#line 854 "glslang.y"
2644
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2645
if (yyval.interm.intermTypedNode == 0) {
2646
parseContext.binaryOpError(yyvsp[-1].lex.line, "==", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2647
parseContext.recover();
2648
constUnion *unionArray = new constUnion[1];
2649
unionArray->bConst = false;
2650
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2656
#line 864 "glslang.y"
2658
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpNotEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2659
if (yyval.interm.intermTypedNode == 0) {
2660
parseContext.binaryOpError(yyvsp[-1].lex.line, "!=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2661
parseContext.recover();
2662
constUnion *unionArray = new constUnion[1];
2663
unionArray->bConst = false;
2664
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2670
#line 877 "glslang.y"
2671
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2675
#line 878 "glslang.y"
2677
PACK_UNPACK_ONLY("&", yyvsp[-1].lex.line);
2678
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2679
if (yyval.interm.intermTypedNode == 0) {
2680
parseContext.binaryOpError(yyvsp[-1].lex.line, "&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2681
parseContext.recover();
2682
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2688
#line 890 "glslang.y"
2689
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2693
#line 891 "glslang.y"
2695
PACK_UNPACK_ONLY("^", yyvsp[-1].lex.line);
2696
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpExclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2697
if (yyval.interm.intermTypedNode == 0) {
2698
parseContext.binaryOpError(yyvsp[-1].lex.line, "^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2699
parseContext.recover();
2700
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2706
#line 903 "glslang.y"
2707
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2711
#line 904 "glslang.y"
2713
PACK_UNPACK_ONLY("|", yyvsp[-1].lex.line);
2714
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpInclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2715
if (yyval.interm.intermTypedNode == 0) {
2716
parseContext.binaryOpError(yyvsp[-1].lex.line, "|", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2717
parseContext.recover();
2718
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2724
#line 916 "glslang.y"
2725
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2729
#line 917 "glslang.y"
2731
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2732
if (yyval.interm.intermTypedNode == 0) {
2733
parseContext.binaryOpError(yyvsp[-1].lex.line, "&&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2734
parseContext.recover();
2735
constUnion *unionArray = new constUnion[1];
2736
unionArray->bConst = false;
2737
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2743
#line 930 "glslang.y"
2744
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2748
#line 931 "glslang.y"
2750
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalXor, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2751
if (yyval.interm.intermTypedNode == 0) {
2752
parseContext.binaryOpError(yyvsp[-1].lex.line, "^^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2753
parseContext.recover();
2754
constUnion *unionArray = new constUnion[1];
2755
unionArray->bConst = false;
2756
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2762
#line 944 "glslang.y"
2763
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2767
#line 945 "glslang.y"
2769
yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
2770
if (yyval.interm.intermTypedNode == 0) {
2771
parseContext.binaryOpError(yyvsp[-1].lex.line, "||", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2772
parseContext.recover();
2773
constUnion *unionArray = new constUnion[1];
2774
unionArray->bConst = false;
2775
yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
2781
#line 958 "glslang.y"
2782
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2786
#line 959 "glslang.y"
2788
if (parseContext.boolErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.intermTypedNode))
2789
parseContext.recover();
2791
yyval.interm.intermTypedNode = parseContext.intermediate.addSelection(yyvsp[-4].interm.intermTypedNode, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-3].lex.line);
2792
if (yyvsp[-2].interm.intermTypedNode->getType() != yyvsp[0].interm.intermTypedNode->getType())
2793
yyval.interm.intermTypedNode = 0;
2795
if (yyval.interm.intermTypedNode == 0) {
2796
parseContext.binaryOpError(yyvsp[-3].lex.line, ":", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2797
parseContext.recover();
2798
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2804
#line 976 "glslang.y"
2805
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
2809
#line 977 "glslang.y"
2811
if (parseContext.lValueErrorCheck(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode))
2812
parseContext.recover();
2813
yyval.interm.intermTypedNode = parseContext.intermediate.addAssign(yyvsp[-1].interm.op, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line);
2814
if (yyval.interm.intermTypedNode == 0) {
2815
parseContext.assignError(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2816
parseContext.recover();
2817
yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
2823
#line 990 "glslang.y"
2824
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAssign; ;}
2828
#line 991 "glslang.y"
2829
{ FRAG_VERT_ONLY("*=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpMulAssign; ;}
2833
#line 992 "glslang.y"
2834
{ FRAG_VERT_ONLY("/=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpDivAssign; ;}
2838
#line 993 "glslang.y"
2839
{ PACK_UNPACK_ONLY("%=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpModAssign; ;}
2843
#line 994 "glslang.y"
2844
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAddAssign; ;}
2848
#line 995 "glslang.y"
2849
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpSubAssign; ;}
2853
#line 996 "glslang.y"
2854
{ PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLeftShiftAssign; ;}
2858
#line 997 "glslang.y"
2859
{ PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpRightShiftAssign; ;}
2863
#line 998 "glslang.y"
2864
{ PACK_UNPACK_ONLY("&=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAndAssign; ;}
2868
#line 999 "glslang.y"
2869
{ PACK_UNPACK_ONLY("^=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpExclusiveOrAssign; ;}
2873
#line 1000 "glslang.y"
2874
{ PACK_UNPACK_ONLY("|=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpInclusiveOrAssign; ;}
2878
#line 1004 "glslang.y"
2880
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2885
#line 1007 "glslang.y"
2887
yyval.interm.intermTypedNode = parseContext.intermediate.addComma(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);
2888
if (yyval.interm.intermTypedNode == 0) {
2889
parseContext.binaryOpError(yyvsp[-1].lex.line, ",", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
2890
parseContext.recover();
2891
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2897
#line 1018 "glslang.y"
2899
if (parseContext.constErrorCheck(yyvsp[0].interm.intermTypedNode))
2900
parseContext.recover();
2901
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
2906
#line 1026 "glslang.y"
2907
{ yyval.interm.intermNode = 0; ;}
2911
#line 1027 "glslang.y"
2913
if (yyvsp[-1].interm.intermAggregate)
2914
yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence);
2915
yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate;
2920
#line 1035 "glslang.y"
2923
// Multiple declarations of the same function are allowed.
2925
// If this is a definition, the definition production code will check for redefinitions
2926
// (we don't know at this point if it's a definition or not).
2928
// Redeclarations are allowed. But, return types and parameter qualifiers must match.
2930
TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(yyvsp[-1].interm.function->getMangledName()));
2932
if (prevDec->getReturnType() != yyvsp[-1].interm.function->getReturnType()) {
2933
parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same return type", yyvsp[-1].interm.function->getReturnType().getBasicString(), "");
2934
parseContext.recover();
2936
for (int i = 0; i < prevDec->getParamCount(); ++i) {
2937
if ((*prevDec)[i].type->getQualifier() != (*yyvsp[-1].interm.function)[i].type->getQualifier()) {
2938
parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same parameter qualifiers", (*yyvsp[-1].interm.function)[i].type->getQualifierString(), "");
2939
parseContext.recover();
2945
// If this is a redeclaration, it could also be a definition,
2946
// in which case, we want to use the variable names from this one, and not the one that's
2947
// being redeclared. So, pass back up this declaration, not the one in the symbol table.
2949
yyval.interm.function = yyvsp[-1].interm.function;
2950
yyval.interm.line = yyvsp[0].lex.line;
2952
parseContext.symbolTable.insert(*yyval.interm.function);
2957
#line 1071 "glslang.y"
2959
yyval.interm.function = yyvsp[0].interm.function;
2964
#line 1074 "glslang.y"
2966
yyval.interm.function = yyvsp[0].interm.function;
2971
#line 1081 "glslang.y"
2973
// Add the parameter
2974
yyval.interm.function = yyvsp[-1].interm.function;
2975
if (yyvsp[0].interm.param.type->getBasicType() != EbtVoid)
2976
yyvsp[-1].interm.function->addParameter(yyvsp[0].interm.param);
2978
delete yyvsp[0].interm.param.type;
2983
#line 1089 "glslang.y"
2986
// Only first parameter of one-parameter functions can be void
2987
// The check for named parameters not being void is done in parameter_declarator
2989
if (yyvsp[0].interm.param.type->getBasicType() == EbtVoid) {
2991
// This parameter > first is void
2993
parseContext.error(yyvsp[-1].lex.line, "cannot be an argument type except for '(void)'", "void", "");
2994
parseContext.recover();
2995
delete yyvsp[0].interm.param.type;
2997
// Add the parameter
2998
yyval.interm.function = yyvsp[-2].interm.function;
2999
yyvsp[-2].interm.function->addParameter(yyvsp[0].interm.param);
3005
#line 1110 "glslang.y"
3007
if (yyvsp[-2].interm.type.qualifier != EvqGlobal && yyvsp[-2].interm.type.qualifier != EvqTemporary) {
3008
parseContext.error(yyvsp[-1].lex.line, "no qualifiers allowed for function return", getQualifierString(yyvsp[-2].interm.type.qualifier), "");
3009
parseContext.recover();
3011
// make sure a sampler is not involved as well...
3012
if (parseContext.structQualifierErrorCheck(yyvsp[-1].lex.line, yyvsp[-2].interm.type))
3013
parseContext.recover();
3015
// Add the function as a prototype after parsing it (we do not support recursion)
3016
TFunction *function;
3017
TType type(yyvsp[-2].interm.type);
3018
function = new TFunction(yyvsp[-1].lex.string, type);
3019
yyval.interm.function = function;
3024
#line 1129 "glslang.y"
3026
if (yyvsp[-1].interm.type.type == EbtVoid) {
3027
parseContext.error(yyvsp[0].lex.line, "illegal use of type 'void'", yyvsp[0].lex.string->c_str(), "");
3028
parseContext.recover();
3030
if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
3031
parseContext.recover();
3032
TParameter param = {yyvsp[0].lex.string, new TType(yyvsp[-1].interm.type)};
3033
yyval.interm.line = yyvsp[0].lex.line;
3034
yyval.interm.param = param;
3039
#line 1140 "glslang.y"
3041
// Check that we can make an array out of this type
3042
if (yyvsp[-4].interm.type.array) {
3043
parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-4].interm.type).getCompleteString().c_str(), "");
3044
parseContext.recover();
3046
if (parseContext.reservedErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string))
3047
parseContext.recover();
3048
yyvsp[-4].interm.type.array = true;
3049
TType* type = new TType(yyvsp[-4].interm.type);
3050
if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion())
3051
type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
3052
TParameter param = { yyvsp[-3].lex.string, type };
3053
yyval.interm.line = yyvsp[-3].lex.line;
3054
yyval.interm.param = param;
3059
#line 1167 "glslang.y"
3061
yyval.interm = yyvsp[0].interm;
3062
if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
3063
parseContext.recover();
3068
#line 1172 "glslang.y"
3070
yyval.interm = yyvsp[0].interm;
3071
if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type))
3072
parseContext.recover();
3073
if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
3074
parseContext.recover();
3079
#line 1182 "glslang.y"
3081
yyval.interm = yyvsp[0].interm;
3082
if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
3083
parseContext.recover();
3088
#line 1187 "glslang.y"
3090
yyval.interm = yyvsp[0].interm;
3091
if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type))
3092
parseContext.recover();
3093
if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
3094
parseContext.recover();
3099
#line 1197 "glslang.y"
3101
yyval.interm.qualifier = EvqIn;
3106
#line 1200 "glslang.y"
3108
yyval.interm.qualifier = EvqIn;
3113
#line 1203 "glslang.y"
3115
yyval.interm.qualifier = EvqOut;
3120
#line 1206 "glslang.y"
3122
yyval.interm.qualifier = EvqInOut;
3127
#line 1212 "glslang.y"
3129
TParameter param = { 0, new TType(yyvsp[0].interm.type) };
3130
yyval.interm.param = param;
3136
#line 1217 "glslang.y"
3138
// Check that we can make an array out of this type
3139
if (yyvsp[-3].interm.type.array) {
3140
parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-3].interm.type).getCompleteString().c_str(), "");
3141
parseContext.recover();
3143
yyvsp[-3].interm.type.array = true;
3144
TType* type = new TType(yyvsp[-3].interm.type);
3145
if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion())
3146
type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
3148
TParameter param = { 0, type };
3149
yyval.interm.line = yyvsp[-2].lex.line;
3150
yyval.interm.param = param;
3155
#line 1235 "glslang.y"
3157
yyval.interm = yyvsp[0].interm;
3162
#line 1238 "glslang.y"
3164
yyval.interm = yyvsp[-2].interm;
3165
if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.type))
3166
parseContext.recover();
3168
if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
3169
parseContext.recover();
3174
#line 1246 "glslang.y"
3176
yyval.interm = yyvsp[-4].interm;
3177
if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
3178
parseContext.recover();
3180
if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0))
3181
parseContext.recover();
3186
#line 1254 "glslang.y"
3188
yyval.interm = yyvsp[-5].interm;
3189
if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-5].interm.type))
3190
parseContext.recover();
3192
if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode))
3193
parseContext.recover();
3198
#line 1262 "glslang.y"
3200
yyval.interm = yyvsp[-4].interm;
3201
if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
3202
parseContext.recover();
3204
TIntermNode* intermNode;
3205
if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-4].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) {
3207
// build the intermediate representation
3210
yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-4].interm.intermNode, intermNode, yyvsp[-1].lex.line);
3212
yyval.interm.intermAggregate = yyvsp[-4].interm.intermAggregate;
3214
parseContext.recover();
3215
yyval.interm.intermAggregate = 0;
3221
#line 1284 "glslang.y"
3223
yyval.interm.type = yyvsp[0].interm.type;
3224
yyval.interm.intermAggregate = 0;
3229
#line 1288 "glslang.y"
3231
yyval.interm.intermAggregate = 0;
3232
yyval.interm.type = yyvsp[-1].interm.type;
3233
if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-1].interm.type))
3234
parseContext.recover();
3236
if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
3237
parseContext.recover();
3242
#line 1297 "glslang.y"
3244
yyval.interm.intermAggregate = 0;
3245
yyval.interm.type = yyvsp[-3].interm.type;
3246
if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
3247
parseContext.recover();
3249
if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0))
3250
parseContext.recover();
3255
#line 1306 "glslang.y"
3257
yyval.interm.intermAggregate = 0;
3258
yyval.interm.type = yyvsp[-4].interm.type;
3259
if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.type))
3260
parseContext.recover();
3262
if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode))
3263
parseContext.recover();
3268
#line 1315 "glslang.y"
3270
yyval.interm.type = yyvsp[-3].interm.type;
3271
if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
3272
parseContext.recover();
3274
TIntermNode* intermNode;
3275
if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) {
3277
// Build intermediate representation
3280
yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, yyvsp[-1].lex.line);
3282
yyval.interm.intermAggregate = 0;
3284
parseContext.recover();
3285
yyval.interm.intermAggregate = 0;
3291
#line 1405 "glslang.y"
3293
yyval.interm.type = yyvsp[0].interm.type;
3298
#line 1408 "glslang.y"
3300
TPublicType t = { yyvsp[0].interm.type.type, yyvsp[-1].interm.type.qualifier, yyvsp[0].interm.type.size, yyvsp[0].interm.type.matrix, false, yyvsp[0].interm.type.userDef, 0 };
3301
if (yyvsp[-1].interm.type.qualifier == EvqAttribute &&
3302
(yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) {
3303
parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), "");
3304
parseContext.recover();
3306
if ((yyvsp[-1].interm.type.qualifier == EvqVaryingIn || yyvsp[-1].interm.type.qualifier == EvqVaryingOut) &&
3307
(yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) {
3308
parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), "");
3309
parseContext.recover();
3311
yyval.interm.type = t;
3316
#line 1425 "glslang.y"
3318
TPublicType t = { EbtVoid, EvqConst, 1, false, false, 0 };
3319
yyval.interm.type = t;
3324
#line 1429 "glslang.y"
3326
VERTEX_ONLY("attribute", yyvsp[0].lex.line);
3327
if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))
3328
parseContext.recover();
3329
TPublicType t = { EbtVoid, EvqAttribute, 1, false, false, 0 };
3330
yyval.interm.type = t;
3335
#line 1436 "glslang.y"
3337
if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "varying"))
3338
parseContext.recover();
3339
TPublicType t = { EbtVoid, EvqVaryingIn, 1, false, false, 0 };
3340
if (parseContext.language == EShLangVertex)
3341
t.qualifier = EvqVaryingOut;
3342
yyval.interm.type = t;
3347
#line 1444 "glslang.y"
3349
if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "uniform"))
3350
parseContext.recover();
3351
TPublicType t = { EbtVoid, EvqUniform, 1, false, false, 0 };
3352
yyval.interm.type = t;
3357
#line 1453 "glslang.y"
3359
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3360
TPublicType t = { EbtVoid, qual, 1, false, false, 0, yyvsp[0].lex.line };
3361
yyval.interm.type = t;
3366
#line 1458 "glslang.y"
3368
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3369
TPublicType t = { EbtFloat, qual, 1, false, false, 0, yyvsp[0].lex.line };
3370
yyval.interm.type = t;
3375
#line 1463 "glslang.y"
3377
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3378
TPublicType t = { EbtInt, qual, 1, false, false, 0, yyvsp[0].lex.line };
3379
yyval.interm.type = t;
3384
#line 1468 "glslang.y"
3386
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3387
TPublicType t = { EbtBool, qual, 1, false, false, 0, yyvsp[0].lex.line };
3388
yyval.interm.type = t;
3393
#line 1479 "glslang.y"
3395
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3396
TPublicType t = { EbtFloat, qual, 2, false, false, 0, yyvsp[0].lex.line };
3397
yyval.interm.type = t;
3402
#line 1484 "glslang.y"
3404
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3405
TPublicType t = { EbtFloat, qual, 3, false, false, 0, yyvsp[0].lex.line };
3406
yyval.interm.type = t;
3411
#line 1489 "glslang.y"
3413
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3414
TPublicType t = { EbtFloat, qual, 4, false, false, 0, yyvsp[0].lex.line };
3415
yyval.interm.type = t;
3420
#line 1494 "glslang.y"
3422
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3423
TPublicType t = { EbtBool, qual, 2, false, false, 0, yyvsp[0].lex.line };
3424
yyval.interm.type = t;
3429
#line 1499 "glslang.y"
3431
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3432
TPublicType t = { EbtBool, qual, 3, false, false, 0, yyvsp[0].lex.line };
3433
yyval.interm.type = t;
3438
#line 1504 "glslang.y"
3440
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3441
TPublicType t = { EbtBool, qual, 4, false, false, 0, yyvsp[0].lex.line };
3442
yyval.interm.type = t;
3447
#line 1509 "glslang.y"
3449
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3450
TPublicType t = { EbtInt, qual, 2, false, false, 0, yyvsp[0].lex.line };
3451
yyval.interm.type = t;
3456
#line 1514 "glslang.y"
3458
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3459
TPublicType t = { EbtInt, qual, 3, false, false, 0, yyvsp[0].lex.line };
3460
yyval.interm.type = t;
3465
#line 1519 "glslang.y"
3467
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3468
TPublicType t = { EbtInt, qual, 4, false, false, 0, yyvsp[0].lex.line };
3469
yyval.interm.type = t;
3474
#line 1524 "glslang.y"
3476
FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line);
3477
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3478
TPublicType t = { EbtFloat, qual, 2, true, false, 0, yyvsp[0].lex.line };
3479
yyval.interm.type = t;
3484
#line 1530 "glslang.y"
3486
FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line);
3487
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3488
TPublicType t = { EbtFloat, qual, 3, true, false, 0, yyvsp[0].lex.line };
3489
yyval.interm.type = t;
3494
#line 1536 "glslang.y"
3496
FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line);
3497
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3498
TPublicType t = { EbtFloat, qual, 4, true, false, 0, yyvsp[0].lex.line };
3499
yyval.interm.type = t;
3504
#line 1542 "glslang.y"
3506
FRAG_VERT_ONLY("sampler1D", yyvsp[0].lex.line);
3507
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3508
TPublicType t = { EbtSampler1D, qual, 1, false, false, 0, yyvsp[0].lex.line };
3509
yyval.interm.type = t;
3514
#line 1548 "glslang.y"
3516
FRAG_VERT_ONLY("sampler2D", yyvsp[0].lex.line);
3517
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3518
TPublicType t = { EbtSampler2D, qual, 1, false, false, 0, yyvsp[0].lex.line };
3519
yyval.interm.type = t;
3524
#line 1554 "glslang.y"
3526
FRAG_VERT_ONLY("sampler3D", yyvsp[0].lex.line);
3527
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3528
TPublicType t = { EbtSampler3D, qual, 1, false, false, 0, yyvsp[0].lex.line };
3529
yyval.interm.type = t;
3534
#line 1560 "glslang.y"
3536
FRAG_VERT_ONLY("samplerCube", yyvsp[0].lex.line);
3537
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3538
TPublicType t = { EbtSamplerCube, qual, 1, false, false, 0, yyvsp[0].lex.line };
3539
yyval.interm.type = t;
3544
#line 1566 "glslang.y"
3546
FRAG_VERT_ONLY("sampler1DShadow", yyvsp[0].lex.line);
3547
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3548
TPublicType t = { EbtSampler1DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line };
3549
yyval.interm.type = t;
3554
#line 1572 "glslang.y"
3556
FRAG_VERT_ONLY("sampler2DShadow", yyvsp[0].lex.line);
3557
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3558
TPublicType t = { EbtSampler2DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line };
3559
yyval.interm.type = t;
3564
#line 1578 "glslang.y"
3566
FRAG_VERT_ONLY("struct", yyvsp[0].interm.type.line);
3567
yyval.interm.type = yyvsp[0].interm.type;
3568
yyval.interm.type.qualifier = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3573
#line 1583 "glslang.y"
3576
// This is for user defined type names. The lexical phase looked up the
3579
TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();
3580
TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3581
TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line };
3582
yyval.interm.type = t;
3587
#line 1596 "glslang.y"
3589
TType* structure = new TType(yyvsp[-1].interm.typeList, *yyvsp[-3].lex.string);
3590
TVariable* userTypeDef = new TVariable(yyvsp[-3].lex.string, *structure, true);
3591
if (! parseContext.symbolTable.insert(*userTypeDef)) {
3592
parseContext.error(yyvsp[-3].lex.line, "redefinition", yyvsp[-3].lex.string->c_str(), "struct");
3593
parseContext.recover();
3595
TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-4].lex.line };
3596
yyval.interm.type = t;
3601
#line 1606 "glslang.y"
3603
TType* structure = new TType(yyvsp[-1].interm.typeList, TString(""));
3604
TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-3].lex.line };
3605
yyval.interm.type = t;
3610
#line 1614 "glslang.y"
3612
yyval.interm.typeList = yyvsp[0].interm.typeList;
3617
#line 1617 "glslang.y"
3619
yyval.interm.typeList = yyvsp[-1].interm.typeList;
3620
for (unsigned int i = 0; i < yyvsp[0].interm.typeList->size(); ++i) {
3621
for (unsigned int j = 0; j < yyval.interm.typeList->size(); ++j) {
3622
if ((*yyval.interm.typeList)[j].type->getFieldName() == (*yyvsp[0].interm.typeList)[i].type->getFieldName()) {
3623
parseContext.error((*yyvsp[0].interm.typeList)[i].line, "duplicate field name in structure:", "struct", (*yyvsp[0].interm.typeList)[i].type->getFieldName().c_str());
3624
parseContext.recover();
3627
yyval.interm.typeList->push_back((*yyvsp[0].interm.typeList)[i]);
3633
#line 1632 "glslang.y"
3635
yyval.interm.typeList = yyvsp[-1].interm.typeList;
3637
if (parseContext.voidErrorCheck(yyvsp[-2].interm.type.line, (*yyvsp[-1].interm.typeList)[0].type->getFieldName(), yyvsp[-2].interm.type)) {
3638
parseContext.recover();
3640
for (unsigned int i = 0; i < yyval.interm.typeList->size(); ++i) {
3642
// Careful not to replace already know aspects of type, like array-ness
3644
(*yyval.interm.typeList)[i].type->setType(yyvsp[-2].interm.type.type, yyvsp[-2].interm.type.size, yyvsp[-2].interm.type.matrix, yyvsp[-2].interm.type.userDef);
3645
if (yyvsp[-2].interm.type.userDef)
3646
(*yyval.interm.typeList)[i].type->setTypeName(yyvsp[-2].interm.type.userDef->getTypeName());
3652
#line 1650 "glslang.y"
3654
yyval.interm.typeList = NewPoolTTypeList();
3655
yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);
3660
#line 1654 "glslang.y"
3662
yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);
3667
#line 1660 "glslang.y"
3669
yyval.interm.typeLine.type = new TType(EbtVoid);
3670
yyval.interm.typeLine.line = yyvsp[0].lex.line;
3671
yyval.interm.typeLine.type->setFieldName(*yyvsp[0].lex.string);
3676
#line 1665 "glslang.y"
3678
yyval.interm.typeLine.type = new TType(EbtVoid);
3679
yyval.interm.typeLine.line = yyvsp[-3].lex.line;
3680
yyval.interm.typeLine.type->setFieldName(*yyvsp[-3].lex.string);
3682
if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion() == 0 || yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getBasicType() != EbtInt ||
3683
yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst <= 0) {
3684
parseContext.error(yyvsp[-2].lex.line, "structure field array size must be a positive integer", yyvsp[-3].lex.string->c_str(), "");
3685
parseContext.recover();
3687
yyval.interm.typeLine.type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
3693
#line 1681 "glslang.y"
3694
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
3698
#line 1685 "glslang.y"
3699
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3703
#line 1689 "glslang.y"
3704
{ yyval.interm.intermNode = yyvsp[0].interm.intermAggregate; ;}
3708
#line 1690 "glslang.y"
3709
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3713
#line 1696 "glslang.y"
3714
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3718
#line 1697 "glslang.y"
3719
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3723
#line 1698 "glslang.y"
3724
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3728
#line 1699 "glslang.y"
3729
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3733
#line 1700 "glslang.y"
3734
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3738
#line 1704 "glslang.y"
3739
{ yyval.interm.intermAggregate = 0; ;}
3743
#line 1705 "glslang.y"
3744
{ parseContext.symbolTable.push(); ;}
3748
#line 1705 "glslang.y"
3749
{ parseContext.symbolTable.pop(); ;}
3753
#line 1705 "glslang.y"
3755
if (yyvsp[-2].interm.intermAggregate != 0)
3756
yyvsp[-2].interm.intermAggregate->setOperator(EOpSequence);
3757
yyval.interm.intermAggregate = yyvsp[-2].interm.intermAggregate;
3762
#line 1713 "glslang.y"
3763
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3767
#line 1714 "glslang.y"
3768
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
3772
#line 1719 "glslang.y"
3774
yyval.interm.intermNode = 0;
3779
#line 1722 "glslang.y"
3781
if (yyvsp[-1].interm.intermAggregate)
3782
yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence);
3783
yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate;
3788
#line 1730 "glslang.y"
3790
yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(yyvsp[0].interm.intermNode, 0);
3795
#line 1733 "glslang.y"
3797
yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);
3802
#line 1739 "glslang.y"
3803
{ yyval.interm.intermNode = 0; ;}
3807
#line 1740 "glslang.y"
3808
{ yyval.interm.intermNode = static_cast<TIntermNode*>(yyvsp[-1].interm.intermTypedNode); ;}
3812
#line 1744 "glslang.y"
3814
if (parseContext.boolErrorCheck(yyvsp[-4].lex.line, yyvsp[-2].interm.intermTypedNode))
3815
parseContext.recover();
3816
yyval.interm.intermNode = parseContext.intermediate.addSelection(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.nodePair, yyvsp[-4].lex.line);
3821
#line 1752 "glslang.y"
3823
yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermNode;
3824
yyval.interm.nodePair.node2 = yyvsp[0].interm.intermNode;
3829
#line 1756 "glslang.y"
3831
yyval.interm.nodePair.node1 = yyvsp[0].interm.intermNode;
3832
yyval.interm.nodePair.node2 = 0;
3837
#line 1766 "glslang.y"
3839
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
3840
if (parseContext.boolErrorCheck(yyvsp[0].interm.intermTypedNode->getLine(), yyvsp[0].interm.intermTypedNode))
3841
parseContext.recover();
3846
#line 1771 "glslang.y"
3848
TIntermNode* intermNode;
3849
if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
3850
parseContext.recover();
3851
if (parseContext.boolErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
3852
parseContext.recover();
3854
if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode))
3855
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
3857
parseContext.recover();
3858
yyval.interm.intermTypedNode = 0;
3864
#line 1788 "glslang.y"
3865
{ parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ;}
3869
#line 1788 "glslang.y"
3871
parseContext.symbolTable.pop();
3872
yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, true, yyvsp[-5].lex.line);
3873
--parseContext.loopNestingLevel;
3878
#line 1793 "glslang.y"
3879
{ ++parseContext.loopNestingLevel; ;}
3883
#line 1793 "glslang.y"
3885
if (parseContext.boolErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.intermTypedNode))
3886
parseContext.recover();
3888
yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[-5].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, false, yyvsp[-4].lex.line);
3889
--parseContext.loopNestingLevel;
3894
#line 1800 "glslang.y"
3895
{ parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ;}
3899
#line 1800 "glslang.y"
3901
parseContext.symbolTable.pop();
3902
yyval.interm.intermNode = parseContext.intermediate.makeAggregate(yyvsp[-3].interm.intermNode, yyvsp[-5].lex.line);
3903
yyval.interm.intermNode = parseContext.intermediate.growAggregate(
3904
yyval.interm.intermNode,
3905
parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node1), reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node2), true, yyvsp[-6].lex.line),
3906
yyvsp[-6].lex.line);
3907
yyval.interm.intermNode->getAsAggregate()->setOperator(EOpSequence);
3908
--parseContext.loopNestingLevel;
3913
#line 1813 "glslang.y"
3915
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
3920
#line 1816 "glslang.y"
3922
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
3927
#line 1822 "glslang.y"
3929
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
3934
#line 1825 "glslang.y"
3936
yyval.interm.intermTypedNode = 0;
3941
#line 1831 "glslang.y"
3943
yyval.interm.nodePair.node1 = yyvsp[-1].interm.intermTypedNode;
3944
yyval.interm.nodePair.node2 = 0;
3949
#line 1835 "glslang.y"
3951
yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermTypedNode;
3952
yyval.interm.nodePair.node2 = yyvsp[0].interm.intermTypedNode;
3957
#line 1842 "glslang.y"
3959
if (parseContext.loopNestingLevel <= 0) {
3960
parseContext.error(yyvsp[-1].lex.line, "continue statement only allowed in loops", "", "");
3961
parseContext.recover();
3963
yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpContinue, yyvsp[-1].lex.line);
3968
#line 1849 "glslang.y"
3970
if (parseContext.loopNestingLevel <= 0) {
3971
parseContext.error(yyvsp[-1].lex.line, "break statement only allowed in loops", "", "");
3972
parseContext.recover();
3974
yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpBreak, yyvsp[-1].lex.line);
3979
#line 1856 "glslang.y"
3981
yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].lex.line);
3982
if (parseContext.currentFunctionType->getBasicType() != EbtVoid) {
3983
parseContext.error(yyvsp[-1].lex.line, "non-void function must return a value", "return", "");
3984
parseContext.recover();
3990
#line 1863 "glslang.y"
3992
yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
3993
parseContext.functionReturnsValue = true;
3994
if (parseContext.currentFunctionType->getBasicType() == EbtVoid) {
3995
parseContext.error(yyvsp[-2].lex.line, "void function cannot return a value", "return", "");
3996
parseContext.recover();
3997
} else if (*(parseContext.currentFunctionType) != yyvsp[-1].interm.intermTypedNode->getType()) {
3998
parseContext.error(yyvsp[-2].lex.line, "function return is not matching type:", "return", "");
3999
parseContext.recover();
4005
#line 1874 "glslang.y"
4007
FRAG_ONLY("discard", yyvsp[-1].lex.line);
4008
yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpKill, yyvsp[-1].lex.line);
4013
#line 1883 "glslang.y"
4015
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
4016
parseContext.treeRoot = yyval.interm.intermNode;
4021
#line 1887 "glslang.y"
4023
yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermNode, yyvsp[0].interm.intermNode, 0);
4024
parseContext.treeRoot = yyval.interm.intermNode;
4029
#line 1894 "glslang.y"
4031
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
4036
#line 1897 "glslang.y"
4038
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
4043
#line 1903 "glslang.y"
4045
TFunction& function = *(yyvsp[0].interm.function);
4046
TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(function.getMangledName()));
4048
// Note: 'prevDec' could be 'function' if this is the first time we've seen function
4049
// as it would have just been put in the symbol table. Otherwise, we're looking up
4050
// an earlier occurance.
4052
if (prevDec->isDefined()) {
4054
// Then this function already has a body.
4056
parseContext.error(yyvsp[0].interm.line, "function already has a body", function.getName().c_str(), "");
4057
parseContext.recover();
4059
prevDec->setDefined();
4062
// Raise error message if main function takes any parameters or return anything other than void
4064
if (function.getName() == "main") {
4065
if (function.getParamCount() > 0) {
4066
parseContext.error(yyvsp[0].interm.line, "function cannot take any parameter(s)", function.getName().c_str(), "");
4067
parseContext.recover();
4069
if (function.getReturnType().getBasicType() != EbtVoid) {
4070
parseContext.error(yyvsp[0].interm.line, "", function.getReturnType().getBasicString(), "main function cannot return a value" );
4071
parseContext.recover();
4076
// New symbol table scope for body of function plus its arguments
4078
parseContext.symbolTable.push();
4081
// Remember the return type for later checking for RETURN statements.
4083
parseContext.currentFunctionType = &(prevDec->getReturnType());
4084
parseContext.functionReturnsValue = false;
4087
// Insert parameters into the symbol table.
4088
// If the parameter has no name, it's not an error, just don't insert it
4089
// (could be used for unused args).
4091
// Also, accumulate the list of parameters into the HIL, so lower level code
4092
// knows where to find parameters.
4094
TIntermAggregate* paramNodes = new TIntermAggregate;
4095
for (int i = 0; i < function.getParamCount(); i++) {
4096
TParameter& param = function[i];
4097
if (param.name != 0) {
4098
TVariable *variable = new TVariable(param.name, *param.type);
4100
// Insert the parameters with name in the symbol table.
4102
if (! parseContext.symbolTable.insert(*variable)) {
4103
parseContext.error(yyvsp[0].interm.line, "redefinition", variable->getName().c_str(), "");
4104
parseContext.recover();
4108
// Transfer ownership of name pointer to symbol table.
4113
// Add the parameter to the HIL
4115
paramNodes = parseContext.intermediate.growAggregate(
4117
parseContext.intermediate.addSymbol(variable->getUniqueId(),
4118
variable->getName(),
4119
variable->getType(), yyvsp[0].interm.line),
4120
yyvsp[0].interm.line);
4122
paramNodes = parseContext.intermediate.growAggregate(paramNodes, parseContext.intermediate.addSymbol(0, "", *param.type, yyvsp[0].interm.line), yyvsp[0].interm.line);
4125
parseContext.intermediate.setAggregateOperator(paramNodes, EOpParameters, yyvsp[0].interm.line);
4126
yyvsp[0].interm.intermAggregate = paramNodes;
4127
parseContext.loopNestingLevel = 0;
4132
#line 1988 "glslang.y"
4134
//?? Check that all paths return a value if return type != void ?
4135
// May be best done as post process phase on intermediate code
4136
if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) {
4137
parseContext.error(yyvsp[-2].interm.line, "function does not return a value:", "", yyvsp[-2].interm.function->getName().c_str());
4138
parseContext.recover();
4140
parseContext.symbolTable.pop();
4141
yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);
4142
parseContext.intermediate.setAggregateOperator(yyval.interm.intermNode, EOpFunction, yyvsp[-2].interm.line);
4143
yyval.interm.intermNode->getAsAggregate()->setName(yyvsp[-2].interm.function->getMangledName().c_str());
4144
yyval.interm.intermNode->getAsAggregate()->setType(yyvsp[-2].interm.function->getReturnType());
4146
// store the pragma information for debug and optimize and other vendor specific
4147
// information. This information can be queried from the parse tree
4148
yyval.interm.intermNode->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
4149
yyval.interm.intermNode->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
4150
yyval.interm.intermNode->getAsAggregate()->addToPragmaTable(parseContext.contextPragma.pragmaTable);
4157
/* Line 999 of yacc.c. */
4158
#line 4158 "glslang.tab.c"
4164
YY_STACK_PRINT (yyss, yyssp);
4169
/* Now `shift' the result of the reduction. Determine what state
4170
that goes to, based on the state we popped back to and the rule
4171
number reduced by. */
4175
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4176
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4177
yystate = yytable[yystate];
4179
yystate = yydefgoto[yyn - YYNTOKENS];
4184
/*------------------------------------.
4185
| yyerrlab -- here on detecting error |
4186
`------------------------------------*/
4188
/* If not already recovering from an error, report this error. */
4193
yyn = yypact[yystate];
4195
if (YYPACT_NINF < yyn && yyn < YYLAST)
4197
YYSIZE_T yysize = 0;
4198
int yytype = YYTRANSLATE (yychar);
4203
/* Start YYX at -YYN if negative to avoid negative indexes in
4205
for (yyx = yyn < 0 ? -yyn : 0;
4206
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
4207
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4208
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
4209
yysize += yystrlen ("syntax error, unexpected ") + 1;
4210
yysize += yystrlen (yytname[yytype]);
4211
yymsg = (char *) YYSTACK_ALLOC (yysize);
4214
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
4215
yyp = yystpcpy (yyp, yytname[yytype]);
4220
for (yyx = yyn < 0 ? -yyn : 0;
4221
yyx < (int) (sizeof (yytname) / sizeof (char *));
4223
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4225
const char *yyq = ! yycount ? ", expecting " : " or ";
4226
yyp = yystpcpy (yyp, yyq);
4227
yyp = yystpcpy (yyp, yytname[yyx]);
4232
YYSTACK_FREE (yymsg);
4235
yyerror ("syntax error; also virtual memory exhausted");
4238
#endif /* YYERROR_VERBOSE */
4239
yyerror ("syntax error");
4244
if (yyerrstatus == 3)
4246
/* If just tried and failed to reuse lookahead token after an
4247
error, discard it. */
4249
/* Return failure if at end of input. */
4250
if (yychar == YYEOF)
4252
/* Pop the error token. */
4254
/* Pop the rest of the stack. */
4255
while (yyss < yyssp)
4257
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
4258
yydestruct (yystos[*yyssp], yyvsp);
4264
YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
4265
yydestruct (yytoken, &yylval);
4270
/* Else will try to reuse lookahead token after shifting the error
4275
/*----------------------------------------------------.
4276
| yyerrlab1 -- error raised explicitly by an action. |
4277
`----------------------------------------------------*/
4279
yyerrstatus = 3; /* Each real token shifted decrements this. */
4283
yyn = yypact[yystate];
4284
if (yyn != YYPACT_NINF)
4287
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4295
/* Pop the current state because it cannot handle the error token. */
4299
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
4300
yydestruct (yystos[yystate], yyvsp);
4304
YY_STACK_PRINT (yyss, yyssp);
4310
YYDPRINTF ((stderr, "Shifting error token, "));
4319
/*-------------------------------------.
4320
| yyacceptlab -- YYACCEPT comes here. |
4321
`-------------------------------------*/
4326
/*-----------------------------------.
4327
| yyabortlab -- YYABORT comes here. |
4328
`-----------------------------------*/
4334
/*----------------------------------------------.
4335
| yyoverflowlab -- parser overflow comes here. |
4336
`----------------------------------------------*/
4338
yyerror ("parser stack overflow");
4346
YYSTACK_FREE (yyss);
4352
#line 209 "glslang.y"