Debian Codegraph @

third_party/rust/glslopt/glsl-optimizer/src/compiler/glsl/glsl_parser.cpp

raw
1 /* A Bison parser, made by GNU Bison 3.5. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44 /* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
46
47 /* Identify Bison output. */
48 #define YYBISON 1
49
50 /* Bison version. */
51 #define YYBISON_VERSION "3.5"
52
53 /* Skeleton name. */
54 #define YYSKELETON_NAME "yacc.c"
55
56 /* Pure parsers. */
57 #define YYPURE 1
58
59 /* Push parsers. */
60 #define YYPUSH 0
61
62 /* Pull parsers. */
63 #define YYPULL 1
64
65
66 /* Substitute the variable and function names. */
67 #define yyparse _mesa_glsl_parse
68 #define yylex _mesa_glsl_lex
69 #define yyerror _mesa_glsl_error
70 #define yydebug _mesa_glsl_debug
71 #define yynerrs _mesa_glsl_nerrs
72
73 /* First part of user prologue. */
74 #line 1 "src/compiler/glsl/glsl_parser.yy"
75
76 /*
77 * Copyright © 2008, 2009 Intel Corporation
78 *
79 * Permission is hereby granted, free of charge, to any person obtaining a
80 * copy of this software and associated documentation files (the "Software"),
81 * to deal in the Software without restriction, including without limitation
82 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
83 * and/or sell copies of the Software, and to permit persons to whom the
84 * Software is furnished to do so, subject to the following conditions:
85 *
86 * The above copyright notice and this permission notice (including the next
87 * paragraph) shall be included in all copies or substantial portions of the
88 * Software.
89 *
90 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
91 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
92 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
93 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
94 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
95 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
96 * DEALINGS IN THE SOFTWARE.
97 */
98 #include <stdio.h>
99 #include <stdlib.h>
100 #include <string.h>
101 #ifndef _MSC_VER
102 #include <strings.h>
103 #endif
104 #include <assert.h>
105
106 #include "ast.h"
107 #include "glsl_parser_extras.h"
108 #include "compiler/glsl_types.h"
109 #include "main/context.h"
110 #include "util/u_string.h"
111 #include "util/format/u_format.h"
112
113 #ifdef _MSC_VER
114 #pragma warning( disable : 4065 ) // switch statement contains 'default' but no 'case' labels
115 #endif
116
117 #undef yyerror
118
119 static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
120 {
121 _mesa_glsl_error(loc, st, "%s", msg);
122 }
123
124 static int
125 _mesa_glsl_lex(YYSTYPE *val, YYLTYPE *loc, _mesa_glsl_parse_state *state)
126 {
127 return _mesa_glsl_lexer_lex(val, loc, state->scanner);
128 }
129
130 static bool match_layout_qualifier(const char *s1, const char *s2,
131 _mesa_glsl_parse_state *state)
132 {
133 /* From the GLSL 1.50 spec, section 4.3.8 (Layout Qualifiers):
134 *
135 * "The tokens in any layout-qualifier-id-list ... are not case
136 * sensitive, unless explicitly noted otherwise."
137 *
138 * The text "unless explicitly noted otherwise" appears to be
139 * vacuous--no desktop GLSL spec (up through GLSL 4.40) notes
140 * otherwise.
141 *
142 * However, the GLSL ES 3.00 spec says, in section 4.3.8 (Layout
143 * Qualifiers):
144 *
145 * "As for other identifiers, they are case sensitive."
146 *
147 * So we need to do a case-sensitive or a case-insensitive match,
148 * depending on whether we are compiling for GLSL ES.
149 */
150 if (state->es_shader)
151 return strcmp(s1, s2);
152 else
153 return strcasecmp(s1, s2);
154 }
155
156 #line 157 "src/compiler/glsl/glsl_parser.cpp"
157
158 # ifndef YY_CAST
159 # ifdef __cplusplus
160 # define YY_CAST(Type, Val) static_cast<Type> (Val)
161 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
162 # else
163 # define YY_CAST(Type, Val) ((Type) (Val))
164 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
165 # endif
166 # endif
167 # ifndef YY_NULLPTR
168 # if defined __cplusplus
169 # if 201103L <= __cplusplus
170 # define YY_NULLPTR nullptr
171 # else
172 # define YY_NULLPTR 0
173 # endif
174 # else
175 # define YY_NULLPTR ((void*)0)
176 # endif
177 # endif
178
179 /* Enabling verbose error messages. */
180 #ifdef YYERROR_VERBOSE
181 # undef YYERROR_VERBOSE
182 # define YYERROR_VERBOSE 1
183 #else
184 # define YYERROR_VERBOSE 1
185 #endif
186
187 /* Use api.header.include to #include this header
188 instead of duplicating it here. */
189 #ifndef YY__MESA_GLSL_SRC_COMPILER_GLSL_GLSL_PARSER_H_INCLUDED
190 # define YY__MESA_GLSL_SRC_COMPILER_GLSL_GLSL_PARSER_H_INCLUDED
191 /* Debug traces. */
192 #ifndef YYDEBUG
193 # define YYDEBUG 0
194 #endif
195 #if YYDEBUG
196 extern int _mesa_glsl_debug;
197 #endif
198
199 /* Token type. */
200 #ifndef YYTOKENTYPE
201 # define YYTOKENTYPE
202 enum yytokentype
203 {
204 ATTRIBUTE = 258,
205 CONST_TOK = 259,
206 BASIC_TYPE_TOK = 260,
207 BREAK = 261,
208 BUFFER = 262,
209 CONTINUE = 263,
210 DO = 264,
211 ELSE = 265,
212 FOR = 266,
213 IF = 267,
214 DEMOTE = 268,
215 DISCARD = 269,
216 RETURN = 270,
217 SWITCH = 271,
218 CASE = 272,
219 DEFAULT = 273,
220 CENTROID = 274,
221 IN_TOK = 275,
222 OUT_TOK = 276,
223 INOUT_TOK = 277,
224 UNIFORM = 278,
225 VARYING = 279,
226 SAMPLE = 280,
227 NOPERSPECTIVE = 281,
228 FLAT = 282,
229 SMOOTH = 283,
230 IMAGE1DSHADOW = 284,
231 IMAGE2DSHADOW = 285,
232 IMAGE1DARRAYSHADOW = 286,
233 IMAGE2DARRAYSHADOW = 287,
234 COHERENT = 288,
235 VOLATILE = 289,
236 RESTRICT = 290,
237 READONLY = 291,
238 WRITEONLY = 292,
239 SHARED = 293,
240 STRUCT = 294,
241 VOID_TOK = 295,
242 WHILE = 296,
243 IDENTIFIER = 297,
244 TYPE_IDENTIFIER = 298,
245 NEW_IDENTIFIER = 299,
246 FLOATCONSTANT = 300,
247 DOUBLECONSTANT = 301,
248 INTCONSTANT = 302,
249 UINTCONSTANT = 303,
250 BOOLCONSTANT = 304,
251 INT64CONSTANT = 305,
252 UINT64CONSTANT = 306,
253 FIELD_SELECTION = 307,
254 LEFT_OP = 308,
255 RIGHT_OP = 309,
256 INC_OP = 310,
257 DEC_OP = 311,
258 LE_OP = 312,
259 GE_OP = 313,
260 EQ_OP = 314,
261 NE_OP = 315,
262 AND_OP = 316,
263 OR_OP = 317,
264 XOR_OP = 318,
265 MUL_ASSIGN = 319,
266 DIV_ASSIGN = 320,
267 ADD_ASSIGN = 321,
268 MOD_ASSIGN = 322,
269 LEFT_ASSIGN = 323,
270 RIGHT_ASSIGN = 324,
271 AND_ASSIGN = 325,
272 XOR_ASSIGN = 326,
273 OR_ASSIGN = 327,
274 SUB_ASSIGN = 328,
275 INVARIANT = 329,
276 PRECISE = 330,
277 LOWP = 331,
278 MEDIUMP = 332,
279 HIGHP = 333,
280 SUPERP = 334,
281 PRECISION = 335,
282 VERSION_TOK = 336,
283 EXTENSION = 337,
284 LINE = 338,
285 COLON = 339,
286 EOL = 340,
287 INTERFACE = 341,
288 OUTPUT = 342,
289 PRAGMA_DEBUG_ON = 343,
290 PRAGMA_DEBUG_OFF = 344,
291 PRAGMA_OPTIMIZE_ON = 345,
292 PRAGMA_OPTIMIZE_OFF = 346,
293 PRAGMA_WARNING_ON = 347,
294 PRAGMA_WARNING_OFF = 348,
295 PRAGMA_INVARIANT_ALL = 349,
296 LAYOUT_TOK = 350,
297 DOT_TOK = 351,
298 ASM = 352,
299 CLASS = 353,
300 UNION = 354,
301 ENUM = 355,
302 TYPEDEF = 356,
303 TEMPLATE = 357,
304 THIS = 358,
305 PACKED_TOK = 359,
306 GOTO = 360,
307 INLINE_TOK = 361,
308 NOINLINE = 362,
309 PUBLIC_TOK = 363,
310 STATIC = 364,
311 EXTERN = 365,
312 EXTERNAL = 366,
313 LONG_TOK = 367,
314 SHORT_TOK = 368,
315 HALF = 369,
316 FIXED_TOK = 370,
317 UNSIGNED = 371,
318 INPUT_TOK = 372,
319 HVEC2 = 373,
320 HVEC3 = 374,
321 HVEC4 = 375,
322 FVEC2 = 376,
323 FVEC3 = 377,
324 FVEC4 = 378,
325 SAMPLER3DRECT = 379,
326 SIZEOF = 380,
327 CAST = 381,
328 NAMESPACE = 382,
329 USING = 383,
330 RESOURCE = 384,
331 PATCH = 385,
332 SUBROUTINE = 386,
333 ERROR_TOK = 387,
334 COMMON = 388,
335 PARTITION = 389,
336 ACTIVE = 390,
337 FILTER = 391,
338 ROW_MAJOR = 392,
339 THEN = 393
340 };
341 #endif
342
343 /* Value type. */
344 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
345 union YYSTYPE
346 {
347 #line 101 "src/compiler/glsl/glsl_parser.yy"
348
349 int n;
350 int64_t n64;
351 float real;
352 double dreal;
353 const char *identifier;
354
355 struct ast_type_qualifier type_qualifier;
356
357 ast_node *node;
358 ast_type_specifier *type_specifier;
359 ast_array_specifier *array_specifier;
360 ast_fully_specified_type *fully_specified_type;
361 ast_function *function;
362 ast_parameter_declarator *parameter_declarator;
363 ast_function_definition *function_definition;
364 ast_compound_statement *compound_statement;
365 ast_expression *expression;
366 ast_declarator_list *declarator_list;
367 ast_struct_specifier *struct_specifier;
368 ast_declaration *declaration;
369 ast_switch_body *switch_body;
370 ast_case_label *case_label;
371 ast_case_label_list *case_label_list;
372 ast_case_statement *case_statement;
373 ast_case_statement_list *case_statement_list;
374 ast_interface_block *interface_block;
375 ast_subroutine_list *subroutine_list;
376 struct {
377 ast_node *cond;
378 ast_expression *rest;
379 } for_rest_statement;
380
381 struct {
382 ast_node *then_statement;
383 ast_node *else_statement;
384 } selection_rest_statement;
385
386 const glsl_type *type;
387
388 #line 389 "src/compiler/glsl/glsl_parser.cpp"
389
390 };
391 typedef union YYSTYPE YYSTYPE;
392 # define YYSTYPE_IS_TRIVIAL 1
393 # define YYSTYPE_IS_DECLARED 1
394 #endif
395
396 /* Location type. */
397 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
398 typedef struct YYLTYPE YYLTYPE;
399 struct YYLTYPE
400 {
401 int first_line;
402 int first_column;
403 int last_line;
404 int last_column;
405 };
406 # define YYLTYPE_IS_DECLARED 1
407 # define YYLTYPE_IS_TRIVIAL 1
408 #endif
409
410
411
412 int _mesa_glsl_parse (struct _mesa_glsl_parse_state *state);
413
414 #endif /* !YY__MESA_GLSL_SRC_COMPILER_GLSL_GLSL_PARSER_H_INCLUDED */
415
416
417
418 #ifdef short
419 # undef short
420 #endif
421
422 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
423 <limits.h> and (if available) <stdint.h> are included
424 so that the code can choose integer types of a good width. */
425
426 #ifndef __PTRDIFF_MAX__
427 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
428 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
429 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
430 # define YY_STDINT_H
431 # endif
432 #endif
433
434 /* Narrow types that promote to a signed type and that can represent a
435 signed or unsigned integer of at least N bits. In tables they can
436 save space and decrease cache pressure. Promoting to a signed type
437 helps avoid bugs in integer arithmetic. */
438
439 #ifdef __INT_LEAST8_MAX__
440 typedef __INT_LEAST8_TYPE__ yytype_int8;
441 #elif defined YY_STDINT_H
442 typedef int_least8_t yytype_int8;
443 #else
444 typedef signed char yytype_int8;
445 #endif
446
447 #ifdef __INT_LEAST16_MAX__
448 typedef __INT_LEAST16_TYPE__ yytype_int16;
449 #elif defined YY_STDINT_H
450 typedef int_least16_t yytype_int16;
451 #else
452 typedef short yytype_int16;
453 #endif
454
455 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
456 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
457 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
458 && UINT_LEAST8_MAX <= INT_MAX)
459 typedef uint_least8_t yytype_uint8;
460 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
461 typedef unsigned char yytype_uint8;
462 #else
463 typedef short yytype_uint8;
464 #endif
465
466 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
467 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
468 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
469 && UINT_LEAST16_MAX <= INT_MAX)
470 typedef uint_least16_t yytype_uint16;
471 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
472 typedef unsigned short yytype_uint16;
473 #else
474 typedef int yytype_uint16;
475 #endif
476
477 #ifndef YYPTRDIFF_T
478 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
479 # define YYPTRDIFF_T __PTRDIFF_TYPE__
480 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
481 # elif defined PTRDIFF_MAX
482 # ifndef ptrdiff_t
483 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
484 # endif
485 # define YYPTRDIFF_T ptrdiff_t
486 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
487 # else
488 # define YYPTRDIFF_T long
489 # define YYPTRDIFF_MAXIMUM LONG_MAX
490 # endif
491 #endif
492
493 #ifndef YYSIZE_T
494 # ifdef __SIZE_TYPE__
495 # define YYSIZE_T __SIZE_TYPE__
496 # elif defined size_t
497 # define YYSIZE_T size_t
498 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
499 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
500 # define YYSIZE_T size_t
501 # else
502 # define YYSIZE_T unsigned
503 # endif
504 #endif
505
506 #define YYSIZE_MAXIMUM \
507 YY_CAST (YYPTRDIFF_T, \
508 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
509 ? YYPTRDIFF_MAXIMUM \
510 : YY_CAST (YYSIZE_T, -1)))
511
512 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
513
514 /* Stored state numbers (used for stacks). */
515 typedef yytype_int16 yy_state_t;
516
517 /* State numbers in computations. */
518 typedef int yy_state_fast_t;
519
520 #ifndef YY_
521 # if defined YYENABLE_NLS && YYENABLE_NLS
522 # if ENABLE_NLS
523 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
524 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
525 # endif
526 # endif
527 # ifndef YY_
528 # define YY_(Msgid) Msgid
529 # endif
530 #endif
531
532 #ifndef YY_ATTRIBUTE_PURE
533 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
534 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
535 # else
536 # define YY_ATTRIBUTE_PURE
537 # endif
538 #endif
539
540 #ifndef YY_ATTRIBUTE_UNUSED
541 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
542 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
543 # else
544 # define YY_ATTRIBUTE_UNUSED
545 # endif
546 #endif
547
548 /* Suppress unused-variable warnings by "using" E. */
549 #if ! defined lint || defined __GNUC__
550 # define YYUSE(E) ((void) (E))
551 #else
552 # define YYUSE(E) /* empty */
553 #endif
554
555 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
556 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
557 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
558 _Pragma ("GCC diagnostic push") \
559 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
560 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
561 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
562 _Pragma ("GCC diagnostic pop")
563 #else
564 # define YY_INITIAL_VALUE(Value) Value
565 #endif
566 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
567 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
568 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
569 #endif
570 #ifndef YY_INITIAL_VALUE
571 # define YY_INITIAL_VALUE(Value) /* Nothing. */
572 #endif
573
574 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
575 # define YY_IGNORE_USELESS_CAST_BEGIN \
576 _Pragma ("GCC diagnostic push") \
577 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
578 # define YY_IGNORE_USELESS_CAST_END \
579 _Pragma ("GCC diagnostic pop")
580 #endif
581 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
582 # define YY_IGNORE_USELESS_CAST_BEGIN
583 # define YY_IGNORE_USELESS_CAST_END
584 #endif
585
586
587 #define YY_ASSERT(E) ((void) (0 && (E)))
588
589 #if ! defined yyoverflow || YYERROR_VERBOSE
590
591 /* The parser invokes alloca or malloc; define the necessary symbols. */
592
593 # ifdef YYSTACK_USE_ALLOCA
594 # if YYSTACK_USE_ALLOCA
595 # ifdef __GNUC__
596 # define YYSTACK_ALLOC __builtin_alloca
597 # elif defined __BUILTIN_VA_ARG_INCR
598 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
599 # elif defined _AIX
600 # define YYSTACK_ALLOC __alloca
601 # elif defined _MSC_VER
602 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
603 # define alloca _alloca
604 # else
605 # define YYSTACK_ALLOC alloca
606 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
607 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
608 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
609 # ifndef EXIT_SUCCESS
610 # define EXIT_SUCCESS 0
611 # endif
612 # endif
613 # endif
614 # endif
615 # endif
616
617 # ifdef YYSTACK_ALLOC
618 /* Pacify GCC's 'empty if-body' warning. */
619 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
620 # ifndef YYSTACK_ALLOC_MAXIMUM
621 /* The OS might guarantee only one guard page at the bottom of the stack,
622 and a page size can be as small as 4096 bytes. So we cannot safely
623 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
624 to allow for a few compiler-allocated temporary stack slots. */
625 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
626 # endif
627 # else
628 # define YYSTACK_ALLOC YYMALLOC
629 # define YYSTACK_FREE YYFREE
630 # ifndef YYSTACK_ALLOC_MAXIMUM
631 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
632 # endif
633 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
634 && ! ((defined YYMALLOC || defined malloc) \
635 && (defined YYFREE || defined free)))
636 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
637 # ifndef EXIT_SUCCESS
638 # define EXIT_SUCCESS 0
639 # endif
640 # endif
641 # ifndef YYMALLOC
642 # define YYMALLOC malloc
643 # if ! defined malloc && ! defined EXIT_SUCCESS
644 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
645 # endif
646 # endif
647 # ifndef YYFREE
648 # define YYFREE free
649 # if ! defined free && ! defined EXIT_SUCCESS
650 void free (void *); /* INFRINGES ON USER NAME SPACE */
651 # endif
652 # endif
653 # endif
654 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
655
656
657 #if (! defined yyoverflow \
658 && (! defined __cplusplus \
659 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
660 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
661
662 /* A type that is properly aligned for any stack member. */
663 union yyalloc
664 {
665 yy_state_t yyss_alloc;
666 YYSTYPE yyvs_alloc;
667 YYLTYPE yyls_alloc;
668 };
669
670 /* The size of the maximum gap between one aligned stack and the next. */
671 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
672
673 /* The size of an array large to enough to hold all stacks, each with
674 N elements. */
675 # define YYSTACK_BYTES(N) \
676 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
677 + YYSIZEOF (YYLTYPE)) \
678 + 2 * YYSTACK_GAP_MAXIMUM)
679
680 # define YYCOPY_NEEDED 1
681
682 /* Relocate STACK from its old location to the new one. The
683 local variables YYSIZE and YYSTACKSIZE give the old and new number of
684 elements in the stack, and YYPTR gives the new location of the
685 stack. Advance YYPTR to a properly aligned location for the next
686 stack. */
687 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
688 do \
689 { \
690 YYPTRDIFF_T yynewbytes; \
691 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
692 Stack = &yyptr->Stack_alloc; \
693 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
694 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
695 } \
696 while (0)
697
698 #endif
699
700 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
701 /* Copy COUNT objects from SRC to DST. The source and destination do
702 not overlap. */
703 # ifndef YYCOPY
704 # if defined __GNUC__ && 1 < __GNUC__
705 # define YYCOPY(Dst, Src, Count) \
706 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
707 # else
708 # define YYCOPY(Dst, Src, Count) \
709 do \
710 { \
711 YYPTRDIFF_T yyi; \
712 for (yyi = 0; yyi < (Count); yyi++) \
713 (Dst)[yyi] = (Src)[yyi]; \
714 } \
715 while (0)
716 # endif
717 # endif
718 #endif /* !YYCOPY_NEEDED */
719
720 /* YYFINAL -- State number of the termination state. */
721 #define YYFINAL 5
722 /* YYLAST -- Last index in YYTABLE. */
723 #define YYLAST 2514
724
725 /* YYNTOKENS -- Number of terminals. */
726 #define YYNTOKENS 162
727 /* YYNNTS -- Number of nonterminals. */
728 #define YYNNTS 111
729 /* YYNRULES -- Number of rules. */
730 #define YYNRULES 312
731 /* YYNSTATES -- Number of states. */
732 #define YYNSTATES 475
733
734 #define YYUNDEFTOK 2
735 #define YYMAXUTOK 393
736
737
738 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
739 as returned by yylex, with out-of-bounds checking. */
740 #define YYTRANSLATE(YYX) \
741 (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
742
743 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
744 as returned by yylex. */
745 static const yytype_uint8 yytranslate[] =
746 {
747 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
748 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
749 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
750 2, 2, 2, 146, 2, 2, 2, 150, 153, 2,
751 139, 140, 148, 144, 143, 145, 2, 149, 2, 2,
752 2, 2, 2, 2, 2, 2, 2, 2, 157, 159,
753 151, 158, 152, 156, 2, 2, 2, 2, 2, 2,
754 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
755 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
756 2, 141, 2, 142, 154, 2, 2, 2, 2, 2,
757 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
758 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
759 2, 2, 2, 160, 155, 161, 147, 2, 2, 2,
760 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
761 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
762 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
763 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
764 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
765 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
766 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
767 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
768 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
769 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
770 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
771 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
772 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
773 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
774 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
775 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
776 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
777 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
778 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
779 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
780 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
781 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
782 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
783 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
784 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
785 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
786 135, 136, 137, 138
787 };
788
789 #if YYDEBUG
790 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
791 static const yytype_int16 yyrline[] =
792 {
793 0, 295, 295, 294, 318, 320, 327, 337, 338, 339,
794 340, 341, 365, 370, 377, 379, 383, 384, 385, 389,
795 398, 406, 414, 425, 426, 430, 437, 444, 451, 458,
796 465, 472, 479, 486, 493, 494, 500, 504, 511, 517,
797 526, 530, 534, 538, 539, 543, 544, 548, 554, 566,
798 570, 576, 590, 591, 597, 603, 613, 614, 615, 616,
799 620, 621, 627, 633, 642, 643, 649, 658, 659, 665,
800 674, 675, 681, 687, 693, 702, 703, 709, 718, 719,
801 728, 729, 738, 739, 748, 749, 758, 759, 768, 769,
802 778, 779, 788, 789, 798, 799, 800, 801, 802, 803,
803 804, 805, 806, 807, 808, 812, 816, 832, 836, 841,
804 845, 850, 867, 871, 872, 876, 881, 889, 907, 918,
805 935, 950, 958, 975, 978, 986, 994, 1006, 1018, 1025,
806 1030, 1035, 1044, 1048, 1049, 1059, 1069, 1079, 1093, 1100,
807 1111, 1122, 1133, 1144, 1156, 1171, 1178, 1196, 1203, 1204,
808 1214, 1737, 1902, 1928, 1933, 1938, 1946, 1951, 1960, 1969,
809 1981, 1986, 1991, 2000, 2005, 2010, 2011, 2012, 2013, 2014,
810 2015, 2016, 2034, 2042, 2067, 2091, 2105, 2110, 2126, 2151,
811 2163, 2171, 2176, 2181, 2188, 2193, 2198, 2203, 2208, 2233,
812 2245, 2250, 2255, 2263, 2268, 2273, 2279, 2284, 2292, 2300,
813 2306, 2316, 2327, 2328, 2336, 2342, 2348, 2357, 2358, 2359,
814 2371, 2376, 2381, 2389, 2396, 2413, 2418, 2426, 2464, 2469,
815 2477, 2483, 2492, 2493, 2497, 2504, 2511, 2518, 2524, 2525,
816 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2539, 2546, 2545,
817 2559, 2560, 2564, 2570, 2579, 2589, 2598, 2610, 2616, 2625,
818 2634, 2639, 2647, 2651, 2669, 2677, 2682, 2690, 2695, 2703,
819 2711, 2719, 2727, 2735, 2743, 2751, 2758, 2765, 2775, 2776,
820 2780, 2782, 2788, 2793, 2802, 2808, 2814, 2820, 2826, 2835,
821 2844, 2845, 2846, 2847, 2848, 2852, 2866, 2870, 2883, 2901,
822 2920, 2925, 2930, 2935, 2940, 2955, 2958, 2963, 2971, 2976,
823 2984, 3008, 3015, 3019, 3026, 3030, 3040, 3049, 3059, 3068,
824 3080, 3102, 3112
825 };
826 #endif
827
828 #if YYDEBUG || YYERROR_VERBOSE || 1
829 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
830 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
831 static const char *const yytname[] =
832 {
833 "$end", "error", "$undefined", "ATTRIBUTE", "CONST_TOK",
834 "BASIC_TYPE_TOK", "BREAK", "BUFFER", "CONTINUE", "DO", "ELSE", "FOR",
835 "IF", "DEMOTE", "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT",
836 "CENTROID", "IN_TOK", "OUT_TOK", "INOUT_TOK", "UNIFORM", "VARYING",
837 "SAMPLE", "NOPERSPECTIVE", "FLAT", "SMOOTH", "IMAGE1DSHADOW",
838 "IMAGE2DSHADOW", "IMAGE1DARRAYSHADOW", "IMAGE2DARRAYSHADOW", "COHERENT",
839 "VOLATILE", "RESTRICT", "READONLY", "WRITEONLY", "SHARED", "STRUCT",
840 "VOID_TOK", "WHILE", "IDENTIFIER", "TYPE_IDENTIFIER", "NEW_IDENTIFIER",
841 "FLOATCONSTANT", "DOUBLECONSTANT", "INTCONSTANT", "UINTCONSTANT",
842 "BOOLCONSTANT", "INT64CONSTANT", "UINT64CONSTANT", "FIELD_SELECTION",
843 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
844 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
845 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
846 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "INVARIANT", "PRECISE", "LOWP",
847 "MEDIUMP", "HIGHP", "SUPERP", "PRECISION", "VERSION_TOK", "EXTENSION",
848 "LINE", "COLON", "EOL", "INTERFACE", "OUTPUT", "PRAGMA_DEBUG_ON",
849 "PRAGMA_DEBUG_OFF", "PRAGMA_OPTIMIZE_ON", "PRAGMA_OPTIMIZE_OFF",
850 "PRAGMA_WARNING_ON", "PRAGMA_WARNING_OFF", "PRAGMA_INVARIANT_ALL",
851 "LAYOUT_TOK", "DOT_TOK", "ASM", "CLASS", "UNION", "ENUM", "TYPEDEF",
852 "TEMPLATE", "THIS", "PACKED_TOK", "GOTO", "INLINE_TOK", "NOINLINE",
853 "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL", "LONG_TOK", "SHORT_TOK",
854 "HALF", "FIXED_TOK", "UNSIGNED", "INPUT_TOK", "HVEC2", "HVEC3", "HVEC4",
855 "FVEC2", "FVEC3", "FVEC4", "SAMPLER3DRECT", "SIZEOF", "CAST",
856 "NAMESPACE", "USING", "RESOURCE", "PATCH", "SUBROUTINE", "ERROR_TOK",
857 "COMMON", "PARTITION", "ACTIVE", "FILTER", "ROW_MAJOR", "THEN", "'('",
858 "')'", "'['", "']'", "','", "'+'", "'-'", "'!'", "'~'", "'*'", "'/'",
859 "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", "':'", "'='", "';'",
860 "'{'", "'}'", "$accept", "translation_unit", "$@1", "version_statement",
861 "pragma_statement", "extension_statement_list", "any_identifier",
862 "extension_statement", "external_declaration_list",
863 "variable_identifier", "primary_expression", "postfix_expression",
864 "integer_expression", "function_call", "function_call_or_method",
865 "function_call_generic", "function_call_header_no_parameters",
866 "function_call_header_with_parameters", "function_call_header",
867 "function_identifier", "unary_expression", "unary_operator",
868 "multiplicative_expression", "additive_expression", "shift_expression",
869 "relational_expression", "equality_expression", "and_expression",
870 "exclusive_or_expression", "inclusive_or_expression",
871 "logical_and_expression", "logical_xor_expression",
872 "logical_or_expression", "conditional_expression",
873 "assignment_expression", "assignment_operator", "expression",
874 "constant_expression", "declaration", "function_prototype",
875 "function_declarator", "function_header_with_parameters",
876 "function_header", "parameter_declarator", "parameter_declaration",
877 "parameter_qualifier", "parameter_direction_qualifier",
878 "parameter_type_specifier", "init_declarator_list", "single_declaration",
879 "fully_specified_type", "layout_qualifier", "layout_qualifier_id_list",
880 "layout_qualifier_id", "interface_block_layout_qualifier",
881 "subroutine_qualifier", "subroutine_type_list",
882 "interpolation_qualifier", "type_qualifier",
883 "auxiliary_storage_qualifier", "storage_qualifier", "memory_qualifier",
884 "array_specifier", "type_specifier", "type_specifier_nonarray",
885 "basic_type_specifier_nonarray", "precision_qualifier",
886 "struct_specifier", "struct_declaration_list", "struct_declaration",
887 "struct_declarator_list", "struct_declarator", "initializer",
888 "initializer_list", "declaration_statement", "statement",
889 "simple_statement", "compound_statement", "$@2",
890 "statement_no_new_scope", "compound_statement_no_new_scope",
891 "statement_list", "expression_statement", "selection_statement",
892 "selection_rest_statement", "condition", "switch_statement",
893 "switch_body", "case_label", "case_label_list", "case_statement",
894 "case_statement_list", "iteration_statement", "for_init_statement",
895 "conditionopt", "for_rest_statement", "jump_statement",
896 "demote_statement", "external_declaration", "function_definition",
897 "interface_block", "basic_interface_block", "interface_qualifier",
898 "instance_name_opt", "member_list", "member_declaration",
899 "layout_uniform_defaults", "layout_buffer_defaults",
900 "layout_in_defaults", "layout_out_defaults", "layout_defaults", YY_NULLPTR
901 };
902 #endif
903
904 # ifdef YYPRINT
905 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
906 (internal) symbol number NUM (which must be that of a token). */
907 static const yytype_int16 yytoknum[] =
908 {
909 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
910 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
911 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
912 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
913 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
914 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
915 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
916 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
917 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
918 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
919 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
920 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
921 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
922 385, 386, 387, 388, 389, 390, 391, 392, 393, 40,
923 41, 91, 93, 44, 43, 45, 33, 126, 42, 47,
924 37, 60, 62, 38, 94, 124, 63, 58, 61, 59,
925 123, 125
926 };
927 # endif
928
929 #define YYPACT_NINF (-292)
930
931 #define yypact_value_is_default(Yyn) \
932 ((Yyn) == YYPACT_NINF)
933
934 #define YYTABLE_NINF (-294)
935
936 #define yytable_value_is_error(Yyn) \
937 0
938
939 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
940 STATE-NUM. */
941 static const yytype_int16 yypact[] =
942 {
943 21, 64, 115, -292, 5, -292, 58, -292, -292, -292,
944 -292, 50, 154, 1766, -292, -292, 61, -292, -292, -292,
945 119, -292, 130, 136, -292, 168, -292, -292, -292, -292,
946 -292, -292, -292, -292, -292, -292, -292, -23, -292, -292,
947 2188, 2188, -292, -292, -292, 167, 132, 144, 147, 153,
948 170, 171, 175, 124, 261, -292, 134, -292, -292, 1667,
949 -292, -122, 141, 131, 173, -120, -292, 210, 2254, 2317,
950 2317, 31, 2383, 2317, 2383, -292, 135, -292, 2317, -292,
951 -292, -292, -292, -292, 241, -292, -292, -292, -292, -292,
952 154, 2125, 126, -292, -292, -292, -292, -292, -292, 2317,
953 2317, -292, 2317, -292, 2317, 2317, -292, -292, 31, -292,
954 -292, -292, -292, -292, -292, -292, 180, -292, 154, -292,
955 -292, -292, 815, -292, -292, 547, 547, -292, -292, -292,
956 547, -292, 2, 547, 547, 547, 154, -292, 149, 151,
957 -59, 155, -32, -31, -20, -17, -292, -292, -292, -292,
958 -292, -292, -292, -292, -292, -292, -292, -292, 2383, -292,
959 -292, 1859, 152, -292, 139, 212, 154, 944, -292, 2125,
960 145, -292, -292, -292, 148, -33, -292, -292, -292, 22,
961 146, 156, 1294, 163, 172, 160, 162, 1772, 177, 186,
962 -292, -292, -292, -292, -292, -292, -292, 1995, 1995, 1995,
963 -292, -292, -292, -292, -292, 165, -292, -292, -292, 123,
964 -292, -292, -292, 188, 32, 2027, 190, 273, 1995, 120,
965 13, 137, 15, 143, 159, 179, 181, 246, 247, -56,
966 -292, -292, -67, -292, 189, 195, -292, -292, -292, -292,
967 497, -292, -292, -292, -292, -292, -292, -292, -292, -292,
968 -292, -292, 31, 154, -292, -292, -292, -57, 1506, -55,
969 -292, -292, -292, -292, -292, -292, -292, -292, 205, -292,
970 1971, 2125, -292, 135, -63, -292, -292, -292, 1007, -292,
971 1995, -292, 180, -292, 154, -292, -292, 309, 1581, 1995,
972 -292, -292, -292, -54, 1995, 1917, -292, -292, 44, -292,
973 1294, -292, -292, 299, 1995, -292, -292, 1995, 213, -292,
974 -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,
975 -292, -292, 1995, -292, 1995, 1995, 1995, 1995, 1995, 1995,
976 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995,
977 1995, 1995, 1995, 1995, 1995, -292, -292, -292, -292, 154,
978 135, 1506, -50, 1506, -292, -292, 1506, -292, -292, 214,
979 154, 191, 2125, 152, 154, -292, -292, -292, -292, -292,
980 220, -292, -292, 1917, 46, -292, 71, 218, 154, 224,
981 -292, 656, -292, 223, 218, -292, -292, -292, -292, -292,
982 120, 120, 13, 13, 137, 137, 137, 137, 15, 15,
983 143, 159, 179, 181, 246, 247, 25, -292, -292, 152,
984 -292, 1506, -292, -109, -292, -292, -45, 323, -292, -292,
985 1995, -292, 215, 233, 1294, 216, 219, 1452, -292, -292,
986 1995, -292, 950, -292, -292, 135, 221, 73, 1995, 1452,
987 368, -292, -8, -292, 1506, -292, -292, -292, -292, -292,
988 -292, 152, -292, 222, 218, -292, 1294, 1995, 226, -292,
989 -292, 1136, 1294, -1, -292, -292, -292, 28, -292, -292,
990 -292, -292, -292, 1294, -292
991 };
992
993 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
994 Performed when YYTABLE does not specify something else to do. Zero
995 means the default is an error. */
996 static const yytype_int16 yydefact[] =
997 {
998 4, 0, 0, 14, 0, 1, 2, 16, 17, 18,
999 5, 0, 0, 0, 15, 6, 0, 185, 184, 208,
1000 191, 181, 187, 188, 189, 190, 186, 182, 162, 161,
1001 160, 193, 194, 195, 196, 197, 192, 0, 207, 206,
1002 163, 164, 212, 211, 210, 0, 0, 0, 0, 0,
1003 0, 0, 0, 0, 0, 183, 156, 284, 282, 3,
1004 281, 0, 0, 114, 123, 0, 133, 138, 168, 170,
1005 167, 0, 165, 166, 169, 145, 202, 204, 171, 205,
1006 20, 280, 111, 286, 0, 309, 310, 311, 312, 283,
1007 0, 0, 0, 191, 187, 188, 190, 23, 24, 163,
1008 164, 143, 168, 173, 165, 169, 144, 172, 0, 7,
1009 8, 9, 10, 12, 13, 11, 0, 209, 0, 22,
1010 21, 108, 0, 285, 112, 123, 123, 129, 130, 131,
1011 123, 115, 0, 123, 123, 123, 0, 109, 16, 18,
1012 139, 0, 191, 187, 188, 190, 175, 287, 301, 303,
1013 305, 307, 176, 174, 146, 177, 294, 178, 168, 180,
1014 288, 0, 203, 179, 0, 0, 0, 0, 215, 0,
1015 0, 155, 154, 153, 150, 0, 148, 152, 158, 0,
1016 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1017 30, 31, 26, 27, 32, 28, 29, 0, 0, 0,
1018 56, 57, 58, 59, 247, 238, 242, 25, 34, 52,
1019 36, 41, 42, 0, 0, 46, 0, 60, 0, 64,
1020 67, 70, 75, 78, 80, 82, 84, 86, 88, 90,
1021 92, 105, 0, 227, 0, 145, 230, 244, 229, 228,
1022 0, 231, 232, 233, 234, 235, 236, 116, 124, 125,
1023 121, 122, 0, 132, 126, 128, 127, 134, 0, 140,
1024 117, 304, 306, 308, 302, 198, 60, 107, 0, 50,
1025 0, 0, 19, 220, 0, 218, 214, 216, 0, 110,
1026 0, 147, 0, 157, 0, 275, 274, 0, 0, 0,
1027 279, 278, 276, 0, 0, 0, 53, 54, 0, 237,
1028 0, 38, 39, 0, 0, 44, 43, 0, 207, 47,
1029 49, 95, 96, 98, 97, 100, 101, 102, 103, 104,
1030 99, 94, 0, 55, 0, 0, 0, 0, 0, 0,
1031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1032 0, 0, 0, 0, 0, 248, 243, 246, 245, 0,
1033 118, 0, 135, 0, 222, 142, 0, 199, 200, 0,
1034 0, 0, 298, 221, 0, 217, 213, 151, 149, 159,
1035 0, 269, 268, 271, 0, 277, 0, 252, 0, 0,
1036 33, 0, 37, 0, 40, 48, 93, 61, 62, 63,
1037 65, 66, 68, 69, 73, 74, 71, 72, 76, 77,
1038 79, 81, 83, 85, 87, 89, 0, 106, 119, 120,
1039 137, 0, 225, 0, 141, 201, 0, 295, 299, 219,
1040 0, 270, 0, 0, 0, 0, 0, 0, 239, 35,
1041 0, 136, 0, 223, 300, 296, 0, 0, 272, 0,
1042 251, 249, 0, 254, 0, 241, 265, 240, 91, 224,
1043 226, 297, 289, 0, 273, 267, 0, 0, 0, 255,
1044 259, 0, 263, 0, 253, 266, 250, 0, 258, 261,
1045 260, 262, 256, 264, 257
1046 };
1047
1048 /* YYPGOTO[NTERM-NUM]. */
1049 static const yytype_int16 yypgoto[] =
1050 {
1051 -292, -292, -292, -292, -292, -292, 14, 9, -292, 53,
1052 -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,
1053 157, -292, -107, -104, -97, -89, 42, 55, 45, 48,
1054 56, 52, -292, -136, -152, -292, -143, -237, -5, -2,
1055 -292, -292, -292, -292, 271, 236, -292, -292, -292, -292,
1056 -90, 1, -292, 116, -292, -292, -292, -292, 317, -38,
1057 -292, -9, -135, -13, -292, -292, 197, -292, 230, -137,
1058 40, 37, -268, -292, 114, -153, -291, -292, -292, -36,
1059 343, 105, 118, -292, -292, 34, -292, -292, -53, -292,
1060 -51, -292, -292, -292, -292, -292, -292, -292, 350, -292,
1061 -46, -292, 338, -292, 51, -292, 352, 355, 356, 361,
1062 -292
1063 };
1064
1065 /* YYDEFGOTO[NTERM-NUM]. */
1066 static const yytype_int16 yydefgoto[] =
1067 {
1068 -1, 2, 13, 3, 58, 6, 273, 347, 59, 207,
1069 208, 209, 383, 210, 211, 212, 213, 214, 215, 216,
1070 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
1071 227, 228, 229, 230, 231, 322, 232, 268, 233, 234,
1072 62, 63, 64, 250, 131, 132, 133, 251, 65, 66,
1073 67, 102, 175, 176, 177, 69, 179, 70, 71, 72,
1074 73, 105, 162, 269, 76, 77, 78, 79, 167, 168,
1075 274, 275, 355, 413, 236, 237, 238, 239, 300, 446,
1076 447, 240, 241, 242, 441, 379, 243, 443, 460, 461,
1077 462, 463, 244, 373, 422, 423, 245, 246, 80, 81,
1078 82, 83, 84, 436, 361, 362, 85, 86, 87, 88,
1079 89
1080 };
1081
1082 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
1083 positive, shift that token. If negative, reduce the rule whose
1084 number is the opposite. If YYTABLE_NINF, syntax error. */
1085 static const yytype_int16 yytable[] =
1086 {
1087 75, 166, 104, 104, 74, 259, 342, 19, 60, 457,
1088 458, 61, -293, -290, 68, 14, 457, 458, 11, 7,
1089 8, 9, 147, 136, -291, 267, 16, -292, 160, 287,
1090 277, 104, 104, 359, 432, 104, 19, 121, 122, 137,
1091 104, 37, 38, 367, 293, 39, 75, 7, 8, 9,
1092 74, 92, 433, 104, 60, 134, 298, 61, 154, 74,
1093 68, 104, 104, 309, 104, 74, 104, 104, 119, 68,
1094 37, 38, 331, 332, 39, 158, 344, 166, 75, 166,
1095 364, 140, 161, 410, 161, 412, 270, 348, 414, 344,
1096 10, 270, 345, 101, 106, 170, 365, 53, 364, 258,
1097 343, 351, 1, 356, 165, 375, 354, 281, 411, 235,
1098 282, 4, 147, 74, 434, 5, 134, 134, 54, 253,
1099 141, 134, 352, 158, 134, 134, 134, 261, 262, 104,
1100 174, 104, 178, 252, 267, 15, 445, 91, 363, 263,
1101 12, 277, 264, 431, 267, 90, 374, 54, 445, 74,
1102 257, 376, 377, 459, 75, 385, 75, 327, 328, 158,
1103 472, 384, 283, -293, 450, 284, 333, 334, 344, 235,
1104 386, 344, 306, 74, -290, 307, 464, 126, 301, 302,
1105 -291, 360, 430, 158, 380, 474, 424, 344, 166, 344,
1106 329, 330, 407, 127, 128, 129, 7, 8, 9, 354,
1107 406, 354, 335, 336, 354, 378, 31, 32, 33, 34,
1108 35, 425, -292, 453, 344, 409, 344, 109, 171, 303,
1109 390, 391, 7, 8, 9, 392, 393, 235, 348, 110,
1110 377, 74, 111, 104, 394, 395, 396, 397, 112, 349,
1111 104, 158, 108, 42, 43, 44, 398, 399, 130, 42,
1112 43, 44, 138, 8, 139, 113, 114, 104, 75, 354,
1113 115, 135, -51, 116, 304, 75, 117, 350, 324, 325,
1114 326, 440, 360, 118, 125, 235, 161, 437, 448, 74,
1115 354, 124, 235, 378, 172, 164, 169, 235, -23, 158,
1116 -24, 74, 354, 270, 260, 454, 174, 272, 369, 271,
1117 451, 158, 288, 466, 279, 285, 280, 340, 469, 471,
1118 341, 289, 337, -113, 467, 286, 294, 173, 266, 290,
1119 471, 291, 135, 135, 104, 295, 299, 135, 305, 310,
1120 135, 135, 135, 338, -50, 104, 339, 311, 312, 313,
1121 314, 315, 316, 317, 318, 319, 320, 357, 121, 75,
1122 370, 382, 417, -45, 296, 297, 415, 103, 107, 420,
1123 235, 344, 248, 408, 427, 429, 249, 435, 235, 254,
1124 255, 256, 74, 439, 438, 323, 442, 444, 456, 400,
1125 452, 465, 158, 468, 402, 146, 152, 153, 403, 155,
1126 157, 159, 426, 401, 405, 163, 247, 404, 368, 278,
1127 416, 419, 371, 455, 123, 381, 372, 421, 470, 120,
1128 156, 235, 473, 418, 235, 74, 103, 107, 74, 146,
1129 148, 155, 159, 149, 150, 158, 235, 266, 158, 151,
1130 74, 321, 0, 0, 0, 0, 0, 266, 0, 0,
1131 158, 0, 0, 235, 0, 0, 0, 74, 235, 235,
1132 0, 0, 74, 74, 0, 0, 0, 158, 0, 0,
1133 235, 0, 158, 158, 74, 0, 0, 0, 0, 0,
1134 0, 0, 0, 0, 158, 146, 0, 0, 0, 0,
1135 0, 387, 388, 389, 266, 266, 266, 266, 266, 266,
1136 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
1137 17, 18, 19, 180, 20, 181, 182, 0, 183, 184,
1138 185, 186, 187, 188, 0, 0, 21, 22, 23, 24,
1139 25, 26, 27, 28, 29, 30, 0, 0, 0, 0,
1140 31, 32, 33, 34, 35, 36, 37, 38, 189, 97,
1141 39, 98, 190, 191, 192, 193, 194, 195, 196, 0,
1142 0, 126, 197, 198, 0, 0, 0, 0, 0, 0,
1143 0, 0, 0, 0, 0, 0, 0, 127, 128, 129,
1144 0, 40, 41, 42, 43, 44, 0, 45, 0, 12,
1145 31, 32, 33, 34, 35, 0, 0, 0, 0, 0,
1146 0, 0, 53, 0, 0, 0, 0, 0, 0, 0,
1147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1148 0, 0, 0, 54, 0, 0, 0, 0, 0, 0,
1149 0, 0, 130, 42, 43, 44, 0, 55, 56, 0,
1150 0, 0, 0, 0, 0, 0, 199, 0, 0, 0,
1151 0, 200, 201, 202, 203, 0, 0, 0, 0, 0,
1152 0, 0, 0, 0, 0, 0, 204, 205, 346, 17,
1153 18, 19, 180, 20, 181, 182, 0, 183, 184, 185,
1154 186, 187, 188, 0, 0, 21, 22, 23, 24, 25,
1155 26, 27, 28, 29, 30, 0, 0, 0, 0, 31,
1156 32, 33, 34, 35, 36, 37, 38, 189, 97, 39,
1157 98, 190, 191, 192, 193, 194, 195, 196, 0, 0,
1158 0, 197, 198, 0, 0, 0, 0, 0, 0, 0,
1159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1160 40, 41, 42, 43, 44, 0, 45, 0, 12, 0,
1161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1162 0, 53, 0, 0, 0, 0, 0, 0, 0, 0,
1163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1164 0, 0, 54, 0, 0, 0, 0, 0, 0, 0,
1165 0, 0, 0, 0, 0, 0, 55, 56, 0, 0,
1166 0, 0, 0, 0, 0, 199, 0, 0, 0, 0,
1167 200, 201, 202, 203, 0, 0, 0, 0, 0, 0,
1168 0, 0, 0, 0, 0, 204, 205, 428, 17, 18,
1169 19, 180, 20, 181, 182, 0, 183, 184, 185, 186,
1170 187, 188, 0, 0, 21, 22, 23, 24, 25, 26,
1171 27, 28, 29, 30, 0, 0, 0, 0, 31, 32,
1172 33, 34, 35, 36, 37, 38, 189, 97, 39, 98,
1173 190, 191, 192, 193, 194, 195, 196, 0, 0, 0,
1174 197, 198, 0, 0, 0, 0, 0, 0, 0, 0,
1175 0, 0, 0, 0, 0, 0, 0, 0, 0, 40,
1176 41, 42, 43, 44, 0, 45, 0, 0, 0, 0,
1177 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1178 53, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1179 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1180 0, 54, 0, 0, 0, 0, 0, 0, 0, 0,
1181 0, 0, 0, 0, 0, 55, 56, 17, 18, 19,
1182 0, 93, 0, 0, 199, 19, 0, 0, 0, 200,
1183 201, 202, 203, 21, 94, 95, 24, 96, 26, 27,
1184 28, 29, 30, 0, 204, 205, 206, 31, 32, 33,
1185 34, 35, 36, 37, 38, 0, 0, 39, 0, 37,
1186 38, 0, 97, 39, 98, 190, 191, 192, 193, 194,
1187 195, 196, 0, 0, 0, 197, 198, 0, 0, 0,
1188 17, 18, 19, 0, 93, 0, 0, 0, 99, 100,
1189 42, 43, 44, 0, 0, 0, 21, 94, 95, 24,
1190 96, 26, 27, 28, 29, 30, 0, 0, 0, 53,
1191 31, 32, 33, 34, 35, 36, 37, 38, 0, 0,
1192 39, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1193 54, 0, 0, 0, 0, 0, 54, 0, 0, 0,
1194 0, 0, 0, 0, 55, 56, 0, 0, 0, 0,
1195 0, 99, 100, 42, 43, 44, 0, 0, 0, 199,
1196 0, 0, 0, 0, 200, 201, 202, 203, 0, 0,
1197 0, 0, 53, 0, 0, 276, 0, 0, 0, 0,
1198 353, 449, 0, 0, 0, 0, 0, 0, 0, 0,
1199 0, 0, 0, 54, 0, 0, 0, 0, 0, 0,
1200 0, 0, 0, 0, 0, 0, 0, 55, 56, 17,
1201 18, 19, 180, 20, 181, 182, 0, 183, 184, 185,
1202 186, 187, 188, 457, 458, 21, 22, 23, 24, 25,
1203 26, 27, 28, 29, 30, 0, 0, 0, 366, 31,
1204 32, 33, 34, 35, 36, 37, 38, 189, 97, 39,
1205 98, 190, 191, 192, 193, 194, 195, 196, 0, 0,
1206 0, 197, 198, 0, 0, 0, 0, 0, 0, 0,
1207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1208 40, 41, 42, 43, 44, 0, 45, 0, 0, 0,
1209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1210 0, 53, 0, 0, 0, 0, 0, 0, 0, 0,
1211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1212 0, 0, 54, 0, 0, 0, 0, 0, 0, 0,
1213 0, 0, 0, 0, 0, 0, 55, 56, 0, 0,
1214 0, 0, 0, 0, 0, 199, 0, 0, 0, 0,
1215 200, 201, 202, 203, 0, 0, 0, 0, 0, 0,
1216 0, 0, 0, 0, 0, 204, 205, 17, 18, 19,
1217 180, 20, 181, 182, 0, 183, 184, 185, 186, 187,
1218 188, 0, 0, 21, 22, 23, 24, 25, 26, 27,
1219 28, 29, 30, 0, 0, 0, 0, 31, 32, 33,
1220 34, 35, 36, 37, 38, 189, 97, 39, 98, 190,
1221 191, 192, 193, 194, 195, 196, 0, 0, 0, 197,
1222 198, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1223 0, 0, 0, 0, 0, 0, 0, 0, 40, 41,
1224 42, 43, 44, 0, 45, 0, 0, 0, 0, 0,
1225 0, 0, 0, 0, 0, 0, 0, 0, 0, 53,
1226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1228 54, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1229 0, 0, 0, 0, 55, 56, 0, 0, 0, 0,
1230 0, 0, 0, 199, 0, 0, 0, 0, 200, 201,
1231 202, 203, 0, 0, 0, 0, 0, 0, 0, 0,
1232 0, 0, 0, 204, 205, 17, 18, 19, 180, 20,
1233 181, 182, 0, 183, 184, 185, 186, 187, 188, 0,
1234 0, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1235 30, 0, 0, 0, 0, 31, 32, 33, 34, 35,
1236 36, 37, 38, 189, 97, 39, 98, 190, 191, 192,
1237 193, 194, 195, 196, 0, 0, 0, 197, 198, 0,
1238 0, 19, 0, 0, 0, 0, 0, 0, 0, 0,
1239 0, 0, 0, 0, 0, 0, 40, 41, 42, 43,
1240 44, 0, 45, 0, 0, 0, 0, 0, 0, 0,
1241 0, 0, 0, 0, 0, 37, 38, 53, 97, 39,
1242 98, 190, 191, 192, 193, 194, 195, 196, 0, 0,
1243 0, 197, 198, 0, 0, 0, 0, 0, 54, 0,
1244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1245 0, 0, 55, 56, 17, 18, 19, 0, 20, 0,
1246 0, 199, 0, 0, 0, 0, 200, 201, 202, 203,
1247 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1248 0, 204, 122, 0, 31, 32, 33, 34, 35, 36,
1249 37, 38, 54, 97, 39, 98, 190, 191, 192, 193,
1250 194, 195, 196, 0, 0, 0, 197, 198, 0, 0,
1251 0, 0, 0, 0, 0, 199, 0, 0, 0, 0,
1252 200, 201, 202, 203, 0, 40, 41, 42, 43, 44,
1253 0, 45, 0, 0, 0, 0, 353, 0, 0, 0,
1254 17, 18, 19, 0, 20, 0, 53, 0, 0, 0,
1255 0, 0, 0, 0, 0, 0, 21, 22, 23, 24,
1256 25, 26, 27, 28, 29, 30, 0, 54, 0, 0,
1257 31, 32, 33, 34, 35, 36, 37, 38, 0, 0,
1258 39, 55, 56, 0, 0, 0, 0, 0, 0, 0,
1259 199, 0, 0, 0, 0, 200, 201, 202, 203, 0,
1260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1261 204, 40, 41, 42, 43, 44, 0, 45, 0, 12,
1262 0, 0, 0, 0, 0, 46, 47, 48, 49, 50,
1263 51, 52, 53, 0, 0, 0, 0, 0, 0, 17,
1264 18, 19, 0, 20, 0, 0, 0, 19, 0, 0,
1265 0, 0, 0, 54, 0, 21, 22, 23, 24, 25,
1266 26, 27, 28, 29, 30, 0, 0, 55, 56, 31,
1267 32, 33, 34, 35, 36, 37, 38, 0, 0, 39,
1268 0, 37, 38, 0, 97, 39, 98, 190, 191, 192,
1269 193, 194, 195, 196, 0, 0, 57, 197, 198, 0,
1270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1271 40, 41, 42, 43, 44, 0, 45, 0, 0, 0,
1272 0, 0, 0, 0, 46, 47, 48, 49, 50, 51,
1273 52, 53, 0, 0, 19, 0, 0, 0, 0, 0,
1274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1275 0, 0, 54, 0, 0, 0, 0, 0, 54, 0,
1276 0, 0, 0, 0, 0, 0, 55, 56, 37, 38,
1277 0, 97, 39, 98, 190, 191, 192, 193, 194, 195,
1278 196, 199, 0, 0, 197, 198, 200, 201, 202, 203,
1279 17, 18, 19, 0, 93, 57, 0, 0, 0, 0,
1280 0, 292, 0, 0, 0, 0, 21, 94, 95, 24,
1281 96, 26, 27, 28, 29, 30, 0, 0, 0, 0,
1282 31, 32, 33, 34, 35, 36, 37, 38, 0, 97,
1283 39, 98, 190, 191, 192, 193, 194, 195, 196, 0,
1284 0, 0, 197, 198, 0, 54, 19, 0, 0, 0,
1285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1286 0, 99, 100, 42, 43, 44, 0, 0, 199, 0,
1287 19, 265, 0, 200, 201, 202, 203, 0, 0, 0,
1288 37, 38, 53, 97, 39, 98, 190, 191, 192, 193,
1289 194, 195, 196, 0, 0, 0, 197, 198, 0, 0,
1290 0, 0, 19, 54, 37, 38, 0, 97, 39, 98,
1291 190, 191, 192, 193, 194, 195, 196, 55, 56, 0,
1292 197, 198, 0, 0, 0, 0, 199, 0, 0, 0,
1293 0, 200, 201, 202, 203, 0, 37, 308, 0, 97,
1294 39, 98, 190, 191, 192, 193, 194, 195, 196, 0,
1295 0, 0, 197, 198, 0, 0, 0, 54, 0, 0,
1296 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1298 199, 54, 0, 358, 0, 200, 201, 202, 203, 0,
1299 0, 0, 0, 0, 0, 0, 0, 0, 17, 18,
1300 19, 0, 93, 0, 199, 0, 0, 0, 0, 200,
1301 201, 202, 203, 54, 21, 94, 95, 24, 96, 26,
1302 27, 28, 29, 30, 0, 0, 0, 0, 31, 32,
1303 33, 34, 35, 36, 37, 38, 199, 0, 39, 0,
1304 0, 200, 201, 202, 203, 0, 0, 0, 0, 0,
1305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1306 0, 17, 18, 0, 0, 93, 0, 0, 0, 99,
1307 100, 42, 43, 44, 0, 0, 0, 21, 94, 95,
1308 24, 96, 26, 27, 28, 29, 30, 0, 0, 0,
1309 53, 31, 32, 33, 34, 35, 36, 0, 0, 0,
1310 97, 0, 98, 0, 0, 0, 0, 0, 0, 0,
1311 0, 54, 0, 0, 0, 0, 0, 0, 0, 0,
1312 0, 0, 0, 0, 0, 55, 56, 17, 18, 0,
1313 0, 142, 99, 100, 42, 43, 44, 0, 0, 0,
1314 0, 0, 0, 21, 143, 144, 24, 145, 26, 27,
1315 28, 29, 30, 53, 0, 0, 0, 31, 32, 33,
1316 34, 35, 36, 0, 0, 0, 0, 0, 0, 0,
1317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1318 0, 0, 0, 0, 0, 0, 0, 0, 55, 56,
1319 17, 18, 0, 0, 93, 0, 0, 0, 99, 100,
1320 42, 43, 44, 0, 0, 0, 21, 94, 95, 24,
1321 96, 26, 27, 28, 29, 30, 0, 0, 0, 53,
1322 31, 32, 33, 34, 35, 36, 0, 0, 0, 0,
1323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1324 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1325 0, 0, 0, 0, 55, 56, 17, 18, 0, 0,
1326 20, 99, 100, 42, 43, 44, 0, 0, 0, 0,
1327 0, 0, 21, 22, 23, 24, 25, 26, 27, 28,
1328 29, 30, 53, 0, 0, 0, 31, 32, 33, 34,
1329 35, 36, 0, 0, 0, 0, 0, 0, 0, 0,
1330 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1331 0, 0, 0, 0, 0, 0, 0, 55, 56, 0,
1332 0, 0, 0, 0, 0, 0, 0, 99, 100, 42,
1333 43, 44, 0, 0, 0, 0, 0, 0, 0, 0,
1334 0, 0, 0, 0, 0, 0, 0, 0, 53, 0,
1335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1336 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1338 0, 0, 0, 55, 56
1339 };
1340
1341 static const yytype_int16 yycheck[] =
1342 {
1343 13, 91, 40, 41, 13, 140, 62, 5, 13, 17,
1344 18, 13, 44, 44, 13, 6, 17, 18, 4, 42,
1345 43, 44, 68, 143, 44, 161, 12, 44, 74, 182,
1346 167, 69, 70, 270, 143, 73, 5, 159, 160, 159,
1347 78, 39, 40, 280, 187, 43, 59, 42, 43, 44,
1348 59, 37, 161, 91, 59, 64, 199, 59, 71, 68,
1349 59, 99, 100, 215, 102, 74, 104, 105, 59, 68,
1350 39, 40, 57, 58, 43, 74, 143, 167, 91, 169,
1351 143, 67, 141, 351, 141, 353, 141, 240, 356, 143,
1352 85, 141, 159, 40, 41, 108, 159, 95, 143, 158,
1353 156, 158, 81, 158, 90, 159, 258, 140, 158, 122,
1354 143, 47, 158, 122, 159, 0, 125, 126, 116, 132,
1355 67, 130, 257, 122, 133, 134, 135, 159, 159, 167,
1356 116, 169, 118, 132, 270, 85, 427, 160, 273, 159,
1357 82, 278, 159, 411, 280, 84, 289, 116, 439, 158,
1358 136, 294, 295, 161, 167, 307, 169, 144, 145, 158,
1359 161, 304, 140, 44, 432, 143, 151, 152, 143, 182,
1360 322, 143, 140, 182, 44, 143, 444, 4, 55, 56,
1361 44, 271, 157, 182, 140, 157, 140, 143, 278, 143,
1362 53, 54, 344, 20, 21, 22, 42, 43, 44, 351,
1363 343, 353, 59, 60, 356, 295, 33, 34, 35, 36,
1364 37, 140, 44, 140, 143, 350, 143, 85, 38, 96,
1365 327, 328, 42, 43, 44, 329, 330, 240, 381, 85,
1366 373, 240, 85, 271, 331, 332, 333, 334, 85, 252,
1367 278, 240, 45, 76, 77, 78, 335, 336, 75, 76,
1368 77, 78, 42, 43, 44, 85, 85, 295, 271, 411,
1369 85, 64, 139, 139, 141, 278, 5, 253, 148, 149,
1370 150, 424, 362, 139, 143, 288, 141, 420, 430, 288,
1371 432, 140, 295, 373, 104, 44, 160, 300, 139, 288,
1372 139, 300, 444, 141, 139, 438, 282, 85, 284, 160,
1373 435, 300, 139, 456, 159, 159, 158, 61, 461, 462,
1374 63, 139, 153, 140, 457, 159, 139, 137, 161, 159,
1375 473, 159, 125, 126, 362, 139, 161, 130, 140, 139,
1376 133, 134, 135, 154, 139, 373, 155, 64, 65, 66,
1377 67, 68, 69, 70, 71, 72, 73, 142, 159, 362,
1378 41, 52, 161, 140, 197, 198, 142, 40, 41, 139,
1379 373, 143, 126, 349, 140, 142, 130, 44, 381, 133,
1380 134, 135, 381, 140, 159, 218, 160, 158, 10, 337,
1381 159, 159, 381, 157, 339, 68, 69, 70, 340, 72,
1382 73, 74, 378, 338, 342, 78, 125, 341, 282, 169,
1383 360, 364, 288, 439, 61, 300, 288, 373, 461, 59,
1384 72, 424, 463, 362, 427, 424, 99, 100, 427, 102,
1385 68, 104, 105, 68, 68, 424, 439, 270, 427, 68,
1386 439, 158, -1, -1, -1, -1, -1, 280, -1, -1,
1387 439, -1, -1, 456, -1, -1, -1, 456, 461, 462,
1388 -1, -1, 461, 462, -1, -1, -1, 456, -1, -1,
1389 473, -1, 461, 462, 473, -1, -1, -1, -1, -1,
1390 -1, -1, -1, -1, 473, 158, -1, -1, -1, -1,
1391 -1, 324, 325, 326, 327, 328, 329, 330, 331, 332,
1392 333, 334, 335, 336, 337, 338, 339, 340, 341, 342,
1393 3, 4, 5, 6, 7, 8, 9, -1, 11, 12,
1394 13, 14, 15, 16, -1, -1, 19, 20, 21, 22,
1395 23, 24, 25, 26, 27, 28, -1, -1, -1, -1,
1396 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
1397 43, 44, 45, 46, 47, 48, 49, 50, 51, -1,
1398 -1, 4, 55, 56, -1, -1, -1, -1, -1, -1,
1399 -1, -1, -1, -1, -1, -1, -1, 20, 21, 22,
1400 -1, 74, 75, 76, 77, 78, -1, 80, -1, 82,
1401 33, 34, 35, 36, 37, -1, -1, -1, -1, -1,
1402 -1, -1, 95, -1, -1, -1, -1, -1, -1, -1,
1403 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1404 -1, -1, -1, 116, -1, -1, -1, -1, -1, -1,
1405 -1, -1, 75, 76, 77, 78, -1, 130, 131, -1,
1406 -1, -1, -1, -1, -1, -1, 139, -1, -1, -1,
1407 -1, 144, 145, 146, 147, -1, -1, -1, -1, -1,
1408 -1, -1, -1, -1, -1, -1, 159, 160, 161, 3,
1409 4, 5, 6, 7, 8, 9, -1, 11, 12, 13,
1410 14, 15, 16, -1, -1, 19, 20, 21, 22, 23,
1411 24, 25, 26, 27, 28, -1, -1, -1, -1, 33,
1412 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
1413 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1414 -1, 55, 56, -1, -1, -1, -1, -1, -1, -1,
1415 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1416 74, 75, 76, 77, 78, -1, 80, -1, 82, -1,
1417 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1418 -1, 95, -1, -1, -1, -1, -1, -1, -1, -1,
1419 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1420 -1, -1, 116, -1, -1, -1, -1, -1, -1, -1,
1421 -1, -1, -1, -1, -1, -1, 130, 131, -1, -1,
1422 -1, -1, -1, -1, -1, 139, -1, -1, -1, -1,
1423 144, 145, 146, 147, -1, -1, -1, -1, -1, -1,
1424 -1, -1, -1, -1, -1, 159, 160, 161, 3, 4,
1425 5, 6, 7, 8, 9, -1, 11, 12, 13, 14,
1426 15, 16, -1, -1, 19, 20, 21, 22, 23, 24,
1427 25, 26, 27, 28, -1, -1, -1, -1, 33, 34,
1428 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1429 45, 46, 47, 48, 49, 50, 51, -1, -1, -1,
1430 55, 56, -1, -1, -1, -1, -1, -1, -1, -1,
1431 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
1432 75, 76, 77, 78, -1, 80, -1, -1, -1, -1,
1433 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1434 95, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1435 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1436 -1, 116, -1, -1, -1, -1, -1, -1, -1, -1,
1437 -1, -1, -1, -1, -1, 130, 131, 3, 4, 5,
1438 -1, 7, -1, -1, 139, 5, -1, -1, -1, 144,
1439 145, 146, 147, 19, 20, 21, 22, 23, 24, 25,
1440 26, 27, 28, -1, 159, 160, 161, 33, 34, 35,
1441 36, 37, 38, 39, 40, -1, -1, 43, -1, 39,
1442 40, -1, 42, 43, 44, 45, 46, 47, 48, 49,
1443 50, 51, -1, -1, -1, 55, 56, -1, -1, -1,
1444 3, 4, 5, -1, 7, -1, -1, -1, 74, 75,
1445 76, 77, 78, -1, -1, -1, 19, 20, 21, 22,
1446 23, 24, 25, 26, 27, 28, -1, -1, -1, 95,
1447 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
1448 43, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1449 116, -1, -1, -1, -1, -1, 116, -1, -1, -1,
1450 -1, -1, -1, -1, 130, 131, -1, -1, -1, -1,
1451 -1, 74, 75, 76, 77, 78, -1, -1, -1, 139,
1452 -1, -1, -1, -1, 144, 145, 146, 147, -1, -1,
1453 -1, -1, 95, -1, -1, 161, -1, -1, -1, -1,
1454 160, 161, -1, -1, -1, -1, -1, -1, -1, -1,
1455 -1, -1, -1, 116, -1, -1, -1, -1, -1, -1,
1456 -1, -1, -1, -1, -1, -1, -1, 130, 131, 3,
1457 4, 5, 6, 7, 8, 9, -1, 11, 12, 13,
1458 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1459 24, 25, 26, 27, 28, -1, -1, -1, 161, 33,
1460 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
1461 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1462 -1, 55, 56, -1, -1, -1, -1, -1, -1, -1,
1463 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1464 74, 75, 76, 77, 78, -1, 80, -1, -1, -1,
1465 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1466 -1, 95, -1, -1, -1, -1, -1, -1, -1, -1,
1467 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1468 -1, -1, 116, -1, -1, -1, -1, -1, -1, -1,
1469 -1, -1, -1, -1, -1, -1, 130, 131, -1, -1,
1470 -1, -1, -1, -1, -1, 139, -1, -1, -1, -1,
1471 144, 145, 146, 147, -1, -1, -1, -1, -1, -1,
1472 -1, -1, -1, -1, -1, 159, 160, 3, 4, 5,
1473 6, 7, 8, 9, -1, 11, 12, 13, 14, 15,
1474 16, -1, -1, 19, 20, 21, 22, 23, 24, 25,
1475 26, 27, 28, -1, -1, -1, -1, 33, 34, 35,
1476 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
1477 46, 47, 48, 49, 50, 51, -1, -1, -1, 55,
1478 56, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1479 -1, -1, -1, -1, -1, -1, -1, -1, 74, 75,
1480 76, 77, 78, -1, 80, -1, -1, -1, -1, -1,
1481 -1, -1, -1, -1, -1, -1, -1, -1, -1, 95,
1482 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1483 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1484 116, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1485 -1, -1, -1, -1, 130, 131, -1, -1, -1, -1,
1486 -1, -1, -1, 139, -1, -1, -1, -1, 144, 145,
1487 146, 147, -1, -1, -1, -1, -1, -1, -1, -1,
1488 -1, -1, -1, 159, 160, 3, 4, 5, 6, 7,
1489 8, 9, -1, 11, 12, 13, 14, 15, 16, -1,
1490 -1, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1491 28, -1, -1, -1, -1, 33, 34, 35, 36, 37,
1492 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1493 48, 49, 50, 51, -1, -1, -1, 55, 56, -1,
1494 -1, 5, -1, -1, -1, -1, -1, -1, -1, -1,
1495 -1, -1, -1, -1, -1, -1, 74, 75, 76, 77,
1496 78, -1, 80, -1, -1, -1, -1, -1, -1, -1,
1497 -1, -1, -1, -1, -1, 39, 40, 95, 42, 43,
1498 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1499 -1, 55, 56, -1, -1, -1, -1, -1, 116, -1,
1500 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1501 -1, -1, 130, 131, 3, 4, 5, -1, 7, -1,
1502 -1, 139, -1, -1, -1, -1, 144, 145, 146, 147,
1503 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1504 -1, 159, 160, -1, 33, 34, 35, 36, 37, 38,
1505 39, 40, 116, 42, 43, 44, 45, 46, 47, 48,
1506 49, 50, 51, -1, -1, -1, 55, 56, -1, -1,
1507 -1, -1, -1, -1, -1, 139, -1, -1, -1, -1,
1508 144, 145, 146, 147, -1, 74, 75, 76, 77, 78,
1509 -1, 80, -1, -1, -1, -1, 160, -1, -1, -1,
1510 3, 4, 5, -1, 7, -1, 95, -1, -1, -1,
1511 -1, -1, -1, -1, -1, -1, 19, 20, 21, 22,
1512 23, 24, 25, 26, 27, 28, -1, 116, -1, -1,
1513 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
1514 43, 130, 131, -1, -1, -1, -1, -1, -1, -1,
1515 139, -1, -1, -1, -1, 144, 145, 146, 147, -1,
1516 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1517 159, 74, 75, 76, 77, 78, -1, 80, -1, 82,
1518 -1, -1, -1, -1, -1, 88, 89, 90, 91, 92,
1519 93, 94, 95, -1, -1, -1, -1, -1, -1, 3,
1520 4, 5, -1, 7, -1, -1, -1, 5, -1, -1,
1521 -1, -1, -1, 116, -1, 19, 20, 21, 22, 23,
1522 24, 25, 26, 27, 28, -1, -1, 130, 131, 33,
1523 34, 35, 36, 37, 38, 39, 40, -1, -1, 43,
1524 -1, 39, 40, -1, 42, 43, 44, 45, 46, 47,
1525 48, 49, 50, 51, -1, -1, 159, 55, 56, -1,
1526 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1527 74, 75, 76, 77, 78, -1, 80, -1, -1, -1,
1528 -1, -1, -1, -1, 88, 89, 90, 91, 92, 93,
1529 94, 95, -1, -1, 5, -1, -1, -1, -1, -1,
1530 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1531 -1, -1, 116, -1, -1, -1, -1, -1, 116, -1,
1532 -1, -1, -1, -1, -1, -1, 130, 131, 39, 40,
1533 -1, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1534 51, 139, -1, -1, 55, 56, 144, 145, 146, 147,
1535 3, 4, 5, -1, 7, 159, -1, -1, -1, -1,
1536 -1, 159, -1, -1, -1, -1, 19, 20, 21, 22,
1537 23, 24, 25, 26, 27, 28, -1, -1, -1, -1,
1538 33, 34, 35, 36, 37, 38, 39, 40, -1, 42,
1539 43, 44, 45, 46, 47, 48, 49, 50, 51, -1,
1540 -1, -1, 55, 56, -1, 116, 5, -1, -1, -1,
1541 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1542 -1, 74, 75, 76, 77, 78, -1, -1, 139, -1,
1543 5, 142, -1, 144, 145, 146, 147, -1, -1, -1,
1544 39, 40, 95, 42, 43, 44, 45, 46, 47, 48,
1545 49, 50, 51, -1, -1, -1, 55, 56, -1, -1,
1546 -1, -1, 5, 116, 39, 40, -1, 42, 43, 44,
1547 45, 46, 47, 48, 49, 50, 51, 130, 131, -1,
1548 55, 56, -1, -1, -1, -1, 139, -1, -1, -1,
1549 -1, 144, 145, 146, 147, -1, 39, 40, -1, 42,
1550 43, 44, 45, 46, 47, 48, 49, 50, 51, -1,
1551 -1, -1, 55, 56, -1, -1, -1, 116, -1, -1,
1552 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1553 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1554 139, 116, -1, 142, -1, 144, 145, 146, 147, -1,
1555 -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
1556 5, -1, 7, -1, 139, -1, -1, -1, -1, 144,
1557 145, 146, 147, 116, 19, 20, 21, 22, 23, 24,
1558 25, 26, 27, 28, -1, -1, -1, -1, 33, 34,
1559 35, 36, 37, 38, 39, 40, 139, -1, 43, -1,
1560 -1, 144, 145, 146, 147, -1, -1, -1, -1, -1,
1561 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1562 -1, 3, 4, -1, -1, 7, -1, -1, -1, 74,
1563 75, 76, 77, 78, -1, -1, -1, 19, 20, 21,
1564 22, 23, 24, 25, 26, 27, 28, -1, -1, -1,
1565 95, 33, 34, 35, 36, 37, 38, -1, -1, -1,
1566 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
1567 -1, 116, -1, -1, -1, -1, -1, -1, -1, -1,
1568 -1, -1, -1, -1, -1, 130, 131, 3, 4, -1,
1569 -1, 7, 74, 75, 76, 77, 78, -1, -1, -1,
1570 -1, -1, -1, 19, 20, 21, 22, 23, 24, 25,
1571 26, 27, 28, 95, -1, -1, -1, 33, 34, 35,
1572 36, 37, 38, -1, -1, -1, -1, -1, -1, -1,
1573 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1574 -1, -1, -1, -1, -1, -1, -1, -1, 130, 131,
1575 3, 4, -1, -1, 7, -1, -1, -1, 74, 75,
1576 76, 77, 78, -1, -1, -1, 19, 20, 21, 22,
1577 23, 24, 25, 26, 27, 28, -1, -1, -1, 95,
1578 33, 34, 35, 36, 37, 38, -1, -1, -1, -1,
1579 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1580 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1581 -1, -1, -1, -1, 130, 131, 3, 4, -1, -1,
1582 7, 74, 75, 76, 77, 78, -1, -1, -1, -1,
1583 -1, -1, 19, 20, 21, 22, 23, 24, 25, 26,
1584 27, 28, 95, -1, -1, -1, 33, 34, 35, 36,
1585 37, 38, -1, -1, -1, -1, -1, -1, -1, -1,
1586 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1587 -1, -1, -1, -1, -1, -1, -1, 130, 131, -1,
1588 -1, -1, -1, -1, -1, -1, -1, 74, 75, 76,
1589 77, 78, -1, -1, -1, -1, -1, -1, -1, -1,
1590 -1, -1, -1, -1, -1, -1, -1, -1, 95, -1,
1591 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1592 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1593 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1594 -1, -1, -1, 130, 131
1595 };
1596
1597 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1598 symbol of state STATE-NUM. */
1599 static const yytype_int16 yystos[] =
1600 {
1601 0, 81, 163, 165, 47, 0, 167, 42, 43, 44,
1602 85, 168, 82, 164, 169, 85, 168, 3, 4, 5,
1603 7, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1604 28, 33, 34, 35, 36, 37, 38, 39, 40, 43,
1605 74, 75, 76, 77, 78, 80, 88, 89, 90, 91,
1606 92, 93, 94, 95, 116, 130, 131, 159, 166, 170,
1607 200, 201, 202, 203, 204, 210, 211, 212, 213, 217,
1608 219, 220, 221, 222, 223, 225, 226, 227, 228, 229,
1609 260, 261, 262, 263, 264, 268, 269, 270, 271, 272,
1610 84, 160, 168, 7, 20, 21, 23, 42, 44, 74,
1611 75, 171, 213, 220, 221, 223, 171, 220, 228, 85,
1612 85, 85, 85, 85, 85, 85, 139, 5, 139, 169,
1613 260, 159, 160, 242, 140, 143, 4, 20, 21, 22,
1614 75, 206, 207, 208, 223, 228, 143, 159, 42, 44,
1615 168, 171, 7, 20, 21, 23, 220, 262, 268, 269,
1616 270, 271, 220, 220, 225, 220, 264, 220, 213, 220,
1617 262, 141, 224, 220, 44, 168, 212, 230, 231, 160,
1618 225, 38, 104, 137, 168, 214, 215, 216, 168, 218,
1619 6, 8, 9, 11, 12, 13, 14, 15, 16, 41,
1620 45, 46, 47, 48, 49, 50, 51, 55, 56, 139,
1621 144, 145, 146, 147, 159, 160, 161, 171, 172, 173,
1622 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
1623 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
1624 195, 196, 198, 200, 201, 225, 236, 237, 238, 239,
1625 243, 244, 245, 248, 254, 258, 259, 206, 207, 207,
1626 205, 209, 213, 225, 207, 207, 207, 168, 158, 224,
1627 139, 159, 159, 159, 159, 142, 182, 195, 199, 225,
1628 141, 160, 85, 168, 232, 233, 161, 231, 230, 159,
1629 158, 140, 143, 140, 143, 159, 159, 237, 139, 139,
1630 159, 159, 159, 198, 139, 139, 182, 182, 198, 161,
1631 240, 55, 56, 96, 141, 140, 140, 143, 40, 196,
1632 139, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1633 73, 158, 197, 182, 148, 149, 150, 144, 145, 53,
1634 54, 57, 58, 151, 152, 59, 60, 153, 154, 155,
1635 61, 63, 62, 156, 143, 159, 161, 169, 237, 225,
1636 168, 158, 224, 160, 196, 234, 158, 142, 142, 199,
1637 212, 266, 267, 224, 143, 159, 161, 199, 215, 168,
1638 41, 236, 244, 255, 198, 159, 198, 198, 212, 247,
1639 140, 243, 52, 174, 198, 196, 196, 182, 182, 182,
1640 184, 184, 185, 185, 186, 186, 186, 186, 187, 187,
1641 188, 189, 190, 191, 192, 193, 198, 196, 168, 224,
1642 234, 158, 234, 235, 234, 142, 232, 161, 266, 233,
1643 139, 247, 256, 257, 140, 140, 168, 140, 161, 142,
1644 157, 234, 143, 161, 159, 44, 265, 198, 159, 140,
1645 237, 246, 160, 249, 158, 238, 241, 242, 196, 161,
1646 234, 224, 159, 140, 198, 241, 10, 17, 18, 161,
1647 250, 251, 252, 253, 234, 159, 237, 198, 157, 237,
1648 250, 237, 161, 252, 157
1649 };
1650
1651 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1652 static const yytype_int16 yyr1[] =
1653 {
1654 0, 162, 164, 163, 165, 165, 165, 166, 166, 166,
1655 166, 166, 166, 166, 167, 167, 168, 168, 168, 169,
1656 170, 170, 170, 171, 171, 172, 172, 172, 172, 172,
1657 172, 172, 172, 172, 173, 173, 173, 173, 173, 173,
1658 174, 175, 176, 177, 177, 178, 178, 179, 179, 180,
1659 181, 181, 182, 182, 182, 182, 183, 183, 183, 183,
1660 184, 184, 184, 184, 185, 185, 185, 186, 186, 186,
1661 187, 187, 187, 187, 187, 188, 188, 188, 189, 189,
1662 190, 190, 191, 191, 192, 192, 193, 193, 194, 194,
1663 195, 195, 196, 196, 197, 197, 197, 197, 197, 197,
1664 197, 197, 197, 197, 197, 198, 198, 199, 200, 200,
1665 200, 200, 201, 202, 202, 203, 203, 204, 205, 205,
1666 205, 206, 206, 207, 207, 207, 207, 207, 207, 208,
1667 208, 208, 209, 210, 210, 210, 210, 210, 211, 211,
1668 211, 211, 211, 211, 211, 212, 212, 213, 214, 214,
1669 215, 215, 215, 216, 216, 216, 217, 217, 218, 218,
1670 219, 219, 219, 220, 220, 220, 220, 220, 220, 220,
1671 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
1672 220, 221, 221, 221, 222, 222, 222, 222, 222, 222,
1673 222, 222, 222, 223, 223, 223, 223, 223, 224, 224,
1674 224, 224, 225, 225, 226, 226, 226, 227, 227, 227,
1675 228, 228, 228, 229, 229, 230, 230, 231, 232, 232,
1676 233, 233, 234, 234, 234, 235, 235, 236, 237, 237,
1677 238, 238, 238, 238, 238, 238, 238, 239, 240, 239,
1678 241, 241, 242, 242, 243, 243, 243, 244, 244, 245,
1679 246, 246, 247, 247, 248, 249, 249, 250, 250, 251,
1680 251, 252, 252, 253, 253, 254, 254, 254, 255, 255,
1681 256, 256, 257, 257, 258, 258, 258, 258, 258, 259,
1682 260, 260, 260, 260, 260, 261, 262, 262, 262, 263,
1683 264, 264, 264, 264, 264, 265, 265, 265, 266, 266,
1684 267, 268, 268, 269, 269, 270, 270, 271, 271, 272,
1685 272, 272, 272
1686 };
1687
1688 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1689 static const yytype_int8 yyr2[] =
1690 {
1691 0, 2, 0, 4, 0, 3, 4, 2, 2, 2,
1692 2, 2, 2, 2, 0, 2, 1, 1, 1, 5,
1693 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
1694 1, 1, 1, 3, 1, 4, 1, 3, 2, 2,
1695 1, 1, 1, 2, 2, 2, 1, 2, 3, 2,
1696 1, 1, 1, 2, 2, 2, 1, 1, 1, 1,
1697 1, 3, 3, 3, 1, 3, 3, 1, 3, 3,
1698 1, 3, 3, 3, 3, 1, 3, 3, 1, 3,
1699 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1700 1, 5, 1, 3, 1, 1, 1, 1, 1, 1,
1701 1, 1, 1, 1, 1, 1, 3, 1, 2, 2,
1702 4, 1, 2, 1, 1, 2, 3, 3, 2, 3,
1703 3, 2, 2, 0, 2, 2, 2, 2, 2, 1,
1704 1, 1, 1, 1, 3, 4, 6, 5, 1, 2,
1705 3, 5, 4, 2, 2, 1, 2, 4, 1, 3,
1706 1, 3, 1, 1, 1, 1, 1, 4, 1, 3,
1707 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1708 1, 1, 2, 2, 2, 2, 2, 2, 2, 2,
1709 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1710 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1711 3, 4, 1, 2, 1, 1, 1, 1, 1, 2,
1712 1, 1, 1, 5, 4, 1, 2, 3, 1, 3,
1713 1, 2, 1, 3, 4, 1, 3, 1, 1, 1,
1714 1, 1, 1, 1, 1, 1, 1, 2, 0, 4,
1715 1, 1, 2, 3, 1, 2, 2, 1, 2, 5,
1716 3, 1, 1, 4, 5, 2, 3, 3, 2, 1,
1717 2, 2, 2, 1, 2, 5, 7, 6, 1, 1,
1718 1, 0, 2, 3, 2, 2, 2, 3, 2, 2,
1719 1, 1, 1, 1, 1, 2, 1, 2, 2, 7,
1720 1, 1, 1, 1, 2, 0, 1, 2, 1, 2,
1721 3, 2, 3, 2, 3, 2, 3, 2, 3, 1,
1722 1, 1, 1
1723 };
1724
1725
1726 #define yyerrok (yyerrstatus = 0)
1727 #define yyclearin (yychar = YYEMPTY)
1728 #define YYEMPTY (-2)
1729 #define YYEOF 0
1730
1731 #define YYACCEPT goto yyacceptlab
1732 #define YYABORT goto yyabortlab
1733 #define YYERROR goto yyerrorlab
1734
1735
1736 #define YYRECOVERING() (!!yyerrstatus)
1737
1738 #define YYBACKUP(Token, Value) \
1739 do \
1740 if (yychar == YYEMPTY) \
1741 { \
1742 yychar = (Token); \
1743 yylval = (Value); \
1744 YYPOPSTACK (yylen); \
1745 yystate = *yyssp; \
1746 goto yybackup; \
1747 } \
1748 else \
1749 { \
1750 yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \
1751 YYERROR; \
1752 } \
1753 while (0)
1754
1755 /* Error token number */
1756 #define YYTERROR 1
1757 #define YYERRCODE 256
1758
1759
1760 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1761 If N is 0, then set CURRENT to the empty location which ends
1762 the previous symbol: RHS[0] (always defined). */
1763
1764 #ifndef YYLLOC_DEFAULT
1765 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1766 do \
1767 if (N) \
1768 { \
1769 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1770 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1771 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1772 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1773 } \
1774 else \
1775 { \
1776 (Current).first_line = (Current).last_line = \
1777 YYRHSLOC (Rhs, 0).last_line; \
1778 (Current).first_column = (Current).last_column = \
1779 YYRHSLOC (Rhs, 0).last_column; \
1780 } \
1781 while (0)
1782 #endif
1783
1784 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1785
1786
1787 /* Enable debugging if requested. */
1788 #if YYDEBUG
1789
1790 # ifndef YYFPRINTF
1791 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1792 # define YYFPRINTF fprintf
1793 # endif
1794
1795 # define YYDPRINTF(Args) \
1796 do { \
1797 if (yydebug) \
1798 YYFPRINTF Args; \
1799 } while (0)
1800
1801
1802 /* YY_LOCATION_PRINT -- Print the location on the stream.
1803 This macro was not mandated originally: define only if we know
1804 we won't break user code: when these are the locations we know. */
1805
1806 #ifndef YY_LOCATION_PRINT
1807 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1808
1809 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
1810
1811 YY_ATTRIBUTE_UNUSED
1812 static int
1813 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
1814 {
1815 int res = 0;
1816 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
1817 if (0 <= yylocp->first_line)
1818 {
1819 res += YYFPRINTF (yyo, "%d", yylocp->first_line);
1820 if (0 <= yylocp->first_column)
1821 res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
1822 }
1823 if (0 <= yylocp->last_line)
1824 {
1825 if (yylocp->first_line < yylocp->last_line)
1826 {
1827 res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
1828 if (0 <= end_col)
1829 res += YYFPRINTF (yyo, ".%d", end_col);
1830 }
1831 else if (0 <= end_col && yylocp->first_column < end_col)
1832 res += YYFPRINTF (yyo, "-%d", end_col);
1833 }
1834 return res;
1835 }
1836
1837 # define YY_LOCATION_PRINT(File, Loc) \
1838 yy_location_print_ (File, &(Loc))
1839
1840 # else
1841 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1842 # endif
1843 #endif
1844
1845
1846 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1847 do { \
1848 if (yydebug) \
1849 { \
1850 YYFPRINTF (stderr, "%s ", Title); \
1851 yy_symbol_print (stderr, \
1852 Type, Value, Location, state); \
1853 YYFPRINTF (stderr, "\n"); \
1854 } \
1855 } while (0)
1856
1857
1858 /*-----------------------------------.
1859 | Print this symbol's value on YYO. |
1860 `-----------------------------------*/
1861
1862 static void
1863 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct _mesa_glsl_parse_state *state)
1864 {
1865 FILE *yyoutput = yyo;
1866 YYUSE (yyoutput);
1867 YYUSE (yylocationp);
1868 YYUSE (state);
1869 if (!yyvaluep)
1870 return;
1871 # ifdef YYPRINT
1872 if (yytype < YYNTOKENS)
1873 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
1874 # endif
1875 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1876 YYUSE (yytype);
1877 YY_IGNORE_MAYBE_UNINITIALIZED_END
1878 }
1879
1880
1881 /*---------------------------.
1882 | Print this symbol on YYO. |
1883 `---------------------------*/
1884
1885 static void
1886 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct _mesa_glsl_parse_state *state)
1887 {
1888 YYFPRINTF (yyo, "%s %s (",
1889 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1890
1891 YY_LOCATION_PRINT (yyo, *yylocationp);
1892 YYFPRINTF (yyo, ": ");
1893 yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, state);
1894 YYFPRINTF (yyo, ")");
1895 }
1896
1897 /*------------------------------------------------------------------.
1898 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1899 | TOP (included). |
1900 `------------------------------------------------------------------*/
1901
1902 static void
1903 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1904 {
1905 YYFPRINTF (stderr, "Stack now");
1906 for (; yybottom <= yytop; yybottom++)
1907 {
1908 int yybot = *yybottom;
1909 YYFPRINTF (stderr, " %d", yybot);
1910 }
1911 YYFPRINTF (stderr, "\n");
1912 }
1913
1914 # define YY_STACK_PRINT(Bottom, Top) \
1915 do { \
1916 if (yydebug) \
1917 yy_stack_print ((Bottom), (Top)); \
1918 } while (0)
1919
1920
1921 /*------------------------------------------------.
1922 | Report that the YYRULE is going to be reduced. |
1923 `------------------------------------------------*/
1924
1925 static void
1926 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, struct _mesa_glsl_parse_state *state)
1927 {
1928 int yylno = yyrline[yyrule];
1929 int yynrhs = yyr2[yyrule];
1930 int yyi;
1931 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1932 yyrule - 1, yylno);
1933 /* The symbols being reduced. */
1934 for (yyi = 0; yyi < yynrhs; yyi++)
1935 {
1936 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1937 yy_symbol_print (stderr,
1938 yystos[yyssp[yyi + 1 - yynrhs]],
1939 &yyvsp[(yyi + 1) - (yynrhs)]
1940 , &(yylsp[(yyi + 1) - (yynrhs)]) , state);
1941 YYFPRINTF (stderr, "\n");
1942 }
1943 }
1944
1945 # define YY_REDUCE_PRINT(Rule) \
1946 do { \
1947 if (yydebug) \
1948 yy_reduce_print (yyssp, yyvsp, yylsp, Rule, state); \
1949 } while (0)
1950
1951 /* Nonzero means print parse trace. It is left uninitialized so that
1952 multiple parsers can coexist. */
1953 int yydebug;
1954 #else /* !YYDEBUG */
1955 # define YYDPRINTF(Args)
1956 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1957 # define YY_STACK_PRINT(Bottom, Top)
1958 # define YY_REDUCE_PRINT(Rule)
1959 #endif /* !YYDEBUG */
1960
1961
1962 /* YYINITDEPTH -- initial size of the parser's stacks. */
1963 #ifndef YYINITDEPTH
1964 # define YYINITDEPTH 200
1965 #endif
1966
1967 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1968 if the built-in stack extension method is used).
1969
1970 Do not make this value too large; the results are undefined if
1971 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1972 evaluated with infinite-precision integer arithmetic. */
1973
1974 #ifndef YYMAXDEPTH
1975 # define YYMAXDEPTH 10000
1976 #endif
1977
1978
1979 #if YYERROR_VERBOSE
1980
1981 # ifndef yystrlen
1982 # if defined __GLIBC__ && defined _STRING_H
1983 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1984 # else
1985 /* Return the length of YYSTR. */
1986 static YYPTRDIFF_T
1987 yystrlen (const char *yystr)
1988 {
1989 YYPTRDIFF_T yylen;
1990 for (yylen = 0; yystr[yylen]; yylen++)
1991 continue;
1992 return yylen;
1993 }
1994 # endif
1995 # endif
1996
1997 # ifndef yystpcpy
1998 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1999 # define yystpcpy stpcpy
2000 # else
2001 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2002 YYDEST. */
2003 static char *
2004 yystpcpy (char *yydest, const char *yysrc)
2005 {
2006 char *yyd = yydest;
2007 const char *yys = yysrc;
2008
2009 while ((*yyd++ = *yys++) != '\0')
2010 continue;
2011
2012 return yyd - 1;
2013 }
2014 # endif
2015 # endif
2016
2017 # ifndef yytnamerr
2018 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2019 quotes and backslashes, so that it's suitable for yyerror. The
2020 heuristic is that double-quoting is unnecessary unless the string
2021 contains an apostrophe, a comma, or backslash (other than
2022 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2023 null, do not copy; instead, return the length of what the result
2024 would have been. */
2025 static YYPTRDIFF_T
2026 yytnamerr (char *yyres, const char *yystr)
2027 {
2028 if (*yystr == '"')
2029 {
2030 YYPTRDIFF_T yyn = 0;
2031 char const *yyp = yystr;
2032
2033 for (;;)
2034 switch (*++yyp)
2035 {
2036 case '\'':
2037 case ',':
2038 goto do_not_strip_quotes;
2039
2040 case '\\':
2041 if (*++yyp != '\\')
2042 goto do_not_strip_quotes;
2043 else
2044 goto append;
2045
2046 append:
2047 default:
2048 if (yyres)
2049 yyres[yyn] = *yyp;
2050 yyn++;
2051 break;
2052
2053 case '"':
2054 if (yyres)
2055 yyres[yyn] = '\0';
2056 return yyn;
2057 }
2058 do_not_strip_quotes: ;
2059 }
2060
2061 if (yyres)
2062 return yystpcpy (yyres, yystr) - yyres;
2063 else
2064 return yystrlen (yystr);
2065 }
2066 # endif
2067
2068 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
2069 about the unexpected token YYTOKEN for the state stack whose top is
2070 YYSSP.
2071
2072 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
2073 not large enough to hold the message. In that case, also set
2074 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
2075 required number of bytes is too large to store. */
2076 static int
2077 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
2078 yy_state_t *yyssp, int yytoken)
2079 {
2080 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2081 /* Internationalized format string. */
2082 const char *yyformat = YY_NULLPTR;
2083 /* Arguments of yyformat: reported tokens (one for the "unexpected",
2084 one per "expected"). */
2085 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2086 /* Actual size of YYARG. */
2087 int yycount = 0;
2088 /* Cumulated lengths of YYARG. */
2089 YYPTRDIFF_T yysize = 0;
2090
2091 /* There are many possibilities here to consider:
2092 - If this state is a consistent state with a default action, then
2093 the only way this function was invoked is if the default action
2094 is an error action. In that case, don't check for expected
2095 tokens because there are none.
2096 - The only way there can be no lookahead present (in yychar) is if
2097 this state is a consistent state with a default action. Thus,
2098 detecting the absence of a lookahead is sufficient to determine
2099 that there is no unexpected or expected token to report. In that
2100 case, just report a simple "syntax error".
2101 - Don't assume there isn't a lookahead just because this state is a
2102 consistent state with a default action. There might have been a
2103 previous inconsistent state, consistent state with a non-default
2104 action, or user semantic action that manipulated yychar.
2105 - Of course, the expected token list depends on states to have
2106 correct lookahead information, and it depends on the parser not
2107 to perform extra reductions after fetching a lookahead from the
2108 scanner and before detecting a syntax error. Thus, state merging
2109 (from LALR or IELR) and default reductions corrupt the expected
2110 token list. However, the list is correct for canonical LR with
2111 one exception: it will still contain any token that will not be
2112 accepted due to an error action in a later state.
2113 */
2114 if (yytoken != YYEMPTY)
2115 {
2116 int yyn = yypact[*yyssp];
2117 YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
2118 yysize = yysize0;
2119 yyarg[yycount++] = yytname[yytoken];
2120 if (!yypact_value_is_default (yyn))
2121 {
2122 /* Start YYX at -YYN if negative to avoid negative indexes in
2123 YYCHECK. In other words, skip the first -YYN actions for
2124 this state because they are default actions. */
2125 int yyxbegin = yyn < 0 ? -yyn : 0;
2126 /* Stay within bounds of both yycheck and yytname. */
2127 int yychecklim = YYLAST - yyn + 1;
2128 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2129 int yyx;
2130
2131 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2132 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
2133 && !yytable_value_is_error (yytable[yyx + yyn]))
2134 {
2135 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2136 {
2137 yycount = 1;
2138 yysize = yysize0;
2139 break;
2140 }
2141 yyarg[yycount++] = yytname[yyx];
2142 {
2143 YYPTRDIFF_T yysize1
2144 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
2145 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
2146 yysize = yysize1;
2147 else
2148 return 2;
2149 }
2150 }
2151 }
2152 }
2153
2154 switch (yycount)
2155 {
2156 # define YYCASE_(N, S) \
2157 case N: \
2158 yyformat = S; \
2159 break
2160 default: /* Avoid compiler warnings. */
2161 YYCASE_(0, YY_("syntax error"));
2162 YYCASE_(1, YY_("syntax error, unexpected %s"));
2163 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
2164 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
2165 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
2166 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
2167 # undef YYCASE_
2168 }
2169
2170 {
2171 /* Don't count the "%s"s in the final size, but reserve room for
2172 the terminator. */
2173 YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
2174 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
2175 yysize = yysize1;
2176 else
2177 return 2;
2178 }
2179
2180 if (*yymsg_alloc < yysize)
2181 {
2182 *yymsg_alloc = 2 * yysize;
2183 if (! (yysize <= *yymsg_alloc
2184 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
2185 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
2186 return 1;
2187 }
2188
2189 /* Avoid sprintf, as that infringes on the user's name space.
2190 Don't have undefined behavior even if the translation
2191 produced a string with the wrong number of "%s"s. */
2192 {
2193 char *yyp = *yymsg;
2194 int yyi = 0;
2195 while ((*yyp = *yyformat) != '\0')
2196 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
2197 {
2198 yyp += yytnamerr (yyp, yyarg[yyi++]);
2199 yyformat += 2;
2200 }
2201 else
2202 {
2203 ++yyp;
2204 ++yyformat;
2205 }
2206 }
2207 return 0;
2208 }
2209 #endif /* YYERROR_VERBOSE */
2210
2211 /*-----------------------------------------------.
2212 | Release the memory associated to this symbol. |
2213 `-----------------------------------------------*/
2214
2215 static void
2216 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, struct _mesa_glsl_parse_state *state)
2217 {
2218 YYUSE (yyvaluep);
2219 YYUSE (yylocationp);
2220 YYUSE (state);
2221 if (!yymsg)
2222 yymsg = "Deleting";
2223 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2224
2225 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2226 YYUSE (yytype);
2227 YY_IGNORE_MAYBE_UNINITIALIZED_END
2228 }
2229
2230
2231
2232
2233 /*----------.
2234 | yyparse. |
2235 `----------*/
2236
2237 int
2238 yyparse (struct _mesa_glsl_parse_state *state)
2239 {
2240 /* The lookahead symbol. */
2241 int yychar;
2242
2243
2244 /* The semantic value of the lookahead symbol. */
2245 /* Default value used for initialization, for pacifying older GCCs
2246 or non-GCC compilers. */
2247 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
2248 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
2249
2250 /* Location data for the lookahead symbol. */
2251 static YYLTYPE yyloc_default
2252 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2253 = { 1, 1, 1, 1 }
2254 # endif
2255 ;
2256 YYLTYPE yylloc = yyloc_default;
2257
2258 /* Number of syntax errors so far. */
2259 int yynerrs;
2260
2261 yy_state_fast_t yystate;
2262 /* Number of tokens to shift before error messages enabled. */
2263 int yyerrstatus;
2264
2265 /* The stacks and their tools:
2266 'yyss': related to states.
2267 'yyvs': related to semantic values.
2268 'yyls': related to locations.
2269
2270 Refer to the stacks through separate pointers, to allow yyoverflow
2271 to reallocate them elsewhere. */
2272
2273 /* The state stack. */
2274 yy_state_t yyssa[YYINITDEPTH];
2275 yy_state_t *yyss;
2276 yy_state_t *yyssp;
2277
2278 /* The semantic value stack. */
2279 YYSTYPE yyvsa[YYINITDEPTH];
2280 YYSTYPE *yyvs;
2281 YYSTYPE *yyvsp;
2282
2283 /* The location stack. */
2284 YYLTYPE yylsa[YYINITDEPTH];
2285 YYLTYPE *yyls;
2286 YYLTYPE *yylsp;
2287
2288 /* The locations where the error started and ended. */
2289 YYLTYPE yyerror_range[3];
2290
2291 YYPTRDIFF_T yystacksize;
2292
2293 int yyn;
2294 int yyresult;
2295 /* Lookahead token as an internal (translated) token number. */
2296 int yytoken = 0;
2297 /* The variables used to return semantic value and location from the
2298 action routines. */
2299 YYSTYPE yyval;
2300 YYLTYPE yyloc;
2301
2302 #if YYERROR_VERBOSE
2303 /* Buffer for error messages, and its allocated size. */
2304 char yymsgbuf[128];
2305 char *yymsg = yymsgbuf;
2306 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
2307 #endif
2308
2309 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2310
2311 /* The number of symbols on the RHS of the reduced rule.
2312 Keep to zero when no symbol should be popped. */
2313 int yylen = 0;
2314
2315 yyssp = yyss = yyssa;
2316 yyvsp = yyvs = yyvsa;
2317 yylsp = yyls = yylsa;
2318 yystacksize = YYINITDEPTH;
2319
2320 YYDPRINTF ((stderr, "Starting parse\n"));
2321
2322 yystate = 0;
2323 yyerrstatus = 0;
2324 yynerrs = 0;
2325 yychar = YYEMPTY; /* Cause a token to be read. */
2326
2327 /* User initialization code. */
2328 #line 89 "src/compiler/glsl/glsl_parser.yy"
2329 {
2330 yylloc.first_line = 1;
2331 yylloc.first_column = 1;
2332 yylloc.last_line = 1;
2333 yylloc.last_column = 1;
2334 yylloc.source = 0;
2335 yylloc.path = NULL;
2336 }
2337
2338 #line 2339 "src/compiler/glsl/glsl_parser.cpp"
2339
2340 yylsp[0] = yylloc;
2341 goto yysetstate;
2342
2343
2344 /*------------------------------------------------------------.
2345 | yynewstate -- push a new state, which is found in yystate. |
2346 `------------------------------------------------------------*/
2347 yynewstate:
2348 /* In all cases, when you get here, the value and location stacks
2349 have just been pushed. So pushing a state here evens the stacks. */
2350 yyssp++;
2351
2352
2353 /*--------------------------------------------------------------------.
2354 | yysetstate -- set current state (the top of the stack) to yystate. |
2355 `--------------------------------------------------------------------*/
2356 yysetstate:
2357 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2358 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
2359 YY_IGNORE_USELESS_CAST_BEGIN
2360 *yyssp = YY_CAST (yy_state_t, yystate);
2361 YY_IGNORE_USELESS_CAST_END
2362
2363 if (yyss + yystacksize - 1 <= yyssp)
2364 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
2365 goto yyexhaustedlab;
2366 #else
2367 {
2368 /* Get the current used size of the three stacks, in elements. */
2369 YYPTRDIFF_T yysize = yyssp - yyss + 1;
2370
2371 # if defined yyoverflow
2372 {
2373 /* Give user a chance to reallocate the stack. Use copies of
2374 these so that the &'s don't force the real ones into
2375 memory. */
2376 yy_state_t *yyss1 = yyss;
2377 YYSTYPE *yyvs1 = yyvs;
2378 YYLTYPE *yyls1 = yyls;
2379
2380 /* Each stack pointer address is followed by the size of the
2381 data in use in that stack, in bytes. This used to be a
2382 conditional around just the two extra args, but that might
2383 be undefined if yyoverflow is a macro. */
2384 yyoverflow (YY_("memory exhausted"),
2385 &yyss1, yysize * YYSIZEOF (*yyssp),
2386 &yyvs1, yysize * YYSIZEOF (*yyvsp),
2387 &yyls1, yysize * YYSIZEOF (*yylsp),
2388 &yystacksize);
2389 yyss = yyss1;
2390 yyvs = yyvs1;
2391 yyls = yyls1;
2392 }
2393 # else /* defined YYSTACK_RELOCATE */
2394 /* Extend the stack our own way. */
2395 if (YYMAXDEPTH <= yystacksize)
2396 goto yyexhaustedlab;
2397 yystacksize *= 2;
2398 if (YYMAXDEPTH < yystacksize)
2399 yystacksize = YYMAXDEPTH;
2400
2401 {
2402 yy_state_t *yyss1 = yyss;
2403 union yyalloc *yyptr =
2404 YY_CAST (union yyalloc *,
2405 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
2406 if (! yyptr)
2407 goto yyexhaustedlab;
2408 YYSTACK_RELOCATE (yyss_alloc, yyss);
2409 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2410 YYSTACK_RELOCATE (yyls_alloc, yyls);
2411 # undef YYSTACK_RELOCATE
2412 if (yyss1 != yyssa)
2413 YYSTACK_FREE (yyss1);
2414 }
2415 # endif
2416
2417 yyssp = yyss + yysize - 1;
2418 yyvsp = yyvs + yysize - 1;
2419 yylsp = yyls + yysize - 1;
2420
2421 YY_IGNORE_USELESS_CAST_BEGIN
2422 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
2423 YY_CAST (long, yystacksize)));
2424 YY_IGNORE_USELESS_CAST_END
2425
2426 if (yyss + yystacksize - 1 <= yyssp)
2427 YYABORT;
2428 }
2429 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
2430
2431 if (yystate == YYFINAL)
2432 YYACCEPT;
2433
2434 goto yybackup;
2435
2436
2437 /*-----------.
2438 | yybackup. |
2439 `-----------*/
2440 yybackup:
2441 /* Do appropriate processing given the current state. Read a
2442 lookahead token if we need one and don't already have one. */
2443
2444 /* First try to decide what to do without reference to lookahead token. */
2445 yyn = yypact[yystate];
2446 if (yypact_value_is_default (yyn))
2447 goto yydefault;
2448
2449 /* Not known => get a lookahead token if don't already have one. */
2450
2451 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2452 if (yychar == YYEMPTY)
2453 {
2454 YYDPRINTF ((stderr, "Reading a token: "));
2455 yychar = yylex (&yylval, &yylloc, state);
2456 }
2457
2458 if (yychar <= YYEOF)
2459 {
2460 yychar = yytoken = YYEOF;
2461 YYDPRINTF ((stderr, "Now at end of input.\n"));
2462 }
2463 else
2464 {
2465 yytoken = YYTRANSLATE (yychar);
2466 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2467 }
2468
2469 /* If the proper action on seeing token YYTOKEN is to reduce or to
2470 detect an error, take that action. */
2471 yyn += yytoken;
2472 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2473 goto yydefault;
2474 yyn = yytable[yyn];
2475 if (yyn <= 0)
2476 {
2477 if (yytable_value_is_error (yyn))
2478 goto yyerrlab;
2479 yyn = -yyn;
2480 goto yyreduce;
2481 }
2482
2483 /* Count tokens shifted since error; after three, turn off error
2484 status. */
2485 if (yyerrstatus)
2486 yyerrstatus--;
2487
2488 /* Shift the lookahead token. */
2489 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2490 yystate = yyn;
2491 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2492 *++yyvsp = yylval;
2493 YY_IGNORE_MAYBE_UNINITIALIZED_END
2494 *++yylsp = yylloc;
2495
2496 /* Discard the shifted token. */
2497 yychar = YYEMPTY;
2498 goto yynewstate;
2499
2500
2501 /*-----------------------------------------------------------.
2502 | yydefault -- do the default action for the current state. |
2503 `-----------------------------------------------------------*/
2504 yydefault:
2505 yyn = yydefact[yystate];
2506 if (yyn == 0)
2507 goto yyerrlab;
2508 goto yyreduce;
2509
2510
2511 /*-----------------------------.
2512 | yyreduce -- do a reduction. |
2513 `-----------------------------*/
2514 yyreduce:
2515 /* yyn is the number of a rule to reduce with. */
2516 yylen = yyr2[yyn];
2517
2518 /* If YYLEN is nonzero, implement the default value of the action:
2519 '$$ = $1'.
2520
2521 Otherwise, the following line sets YYVAL to garbage.
2522 This behavior is undocumented and Bison
2523 users should not rely upon it. Assigning to YYVAL
2524 unconditionally makes the parser a bit smaller, and it avoids a
2525 GCC warning that YYVAL may be used uninitialized. */
2526 yyval = yyvsp[1-yylen];
2527
2528 /* Default location. */
2529 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2530 yyerror_range[1] = yyloc;
2531 YY_REDUCE_PRINT (yyn);
2532 switch (yyn)
2533 {
2534 case 2:
2535 #line 295 "src/compiler/glsl/glsl_parser.yy"
2536 {
2537 _mesa_glsl_initialize_types(state);
2538 }
2539 #line 2540 "src/compiler/glsl/glsl_parser.cpp"
2540 break;
2541
2542 case 3:
2543 #line 299 "src/compiler/glsl/glsl_parser.yy"
2544 {
2545 delete state->symbols;
2546 state->symbols = new(ralloc_parent(state)) glsl_symbol_table;
2547 if (state->es_shader) {
2548 if (state->stage == MESA_SHADER_FRAGMENT) {
2549 state->symbols->add_default_precision_qualifier("int", ast_precision_medium);
2550 } else {
2551 state->symbols->add_default_precision_qualifier("float", ast_precision_high);
2552 state->symbols->add_default_precision_qualifier("int", ast_precision_high);
2553 }
2554 state->symbols->add_default_precision_qualifier("sampler2D", ast_precision_low);
2555 state->symbols->add_default_precision_qualifier("samplerExternalOES", ast_precision_low);
2556 state->symbols->add_default_precision_qualifier("samplerCube", ast_precision_low);
2557 state->symbols->add_default_precision_qualifier("atomic_uint", ast_precision_high);
2558 }
2559 _mesa_glsl_initialize_types(state);
2560 }
2561 #line 2562 "src/compiler/glsl/glsl_parser.cpp"
2562 break;
2563
2564 case 5:
2565 #line 321 "src/compiler/glsl/glsl_parser.yy"
2566 {
2567 state->process_version_directive(&(yylsp[-1]), (yyvsp[-1].n), NULL);
2568 if (state->error) {
2569 YYERROR;
2570 }
2571 }
2572 #line 2573 "src/compiler/glsl/glsl_parser.cpp"
2573 break;
2574
2575 case 6:
2576 #line 328 "src/compiler/glsl/glsl_parser.yy"
2577 {
2578 state->process_version_directive(&(yylsp[-2]), (yyvsp[-2].n), (yyvsp[-1].identifier));
2579 if (state->error) {
2580 YYERROR;
2581 }
2582 }
2583 #line 2584 "src/compiler/glsl/glsl_parser.cpp"
2584 break;
2585
2586 case 7:
2587 #line 337 "src/compiler/glsl/glsl_parser.yy"
2588 { (yyval.node) = NULL; }
2589 #line 2590 "src/compiler/glsl/glsl_parser.cpp"
2590 break;
2591
2592 case 8:
2593 #line 338 "src/compiler/glsl/glsl_parser.yy"
2594 { (yyval.node) = NULL; }
2595 #line 2596 "src/compiler/glsl/glsl_parser.cpp"
2596 break;
2597
2598 case 9:
2599 #line 339 "src/compiler/glsl/glsl_parser.yy"
2600 { (yyval.node) = NULL; }
2601 #line 2602 "src/compiler/glsl/glsl_parser.cpp"
2602 break;
2603
2604 case 10:
2605 #line 340 "src/compiler/glsl/glsl_parser.yy"
2606 { (yyval.node) = NULL; }
2607 #line 2608 "src/compiler/glsl/glsl_parser.cpp"
2608 break;
2609
2610 case 11:
2611 #line 342 "src/compiler/glsl/glsl_parser.yy"
2612 {
2613 /* Pragma invariant(all) cannot be used in a fragment shader.
2614 *
2615 * Page 27 of the GLSL 1.20 spec, Page 53 of the GLSL ES 3.00 spec:
2616 *
2617 * "It is an error to use this pragma in a fragment shader."
2618 */
2619 if (state->is_version(120, 300) &&
2620 state->stage == MESA_SHADER_FRAGMENT) {
2621 _mesa_glsl_error(& (yylsp[-1]), state,
2622 "pragma `invariant(all)' cannot be used "
2623 "in a fragment shader.");
2624 } else if (!state->is_version(120, 100)) {
2625 _mesa_glsl_warning(& (yylsp[-1]), state,
2626 "pragma `invariant(all)' not supported in %s "
2627 "(GLSL ES 1.00 or GLSL 1.20 required)",
2628 state->get_version_string());
2629 } else {
2630 state->all_invariant = true;
2631 }
2632
2633 (yyval.node) = NULL;
2634 }
2635 #line 2636 "src/compiler/glsl/glsl_parser.cpp"
2636 break;
2637
2638 case 12:
2639 #line 366 "src/compiler/glsl/glsl_parser.yy"
2640 {
2641 void *mem_ctx = state->linalloc;
2642 (yyval.node) = new(mem_ctx) ast_warnings_toggle(true);
2643 }
2644 #line 2645 "src/compiler/glsl/glsl_parser.cpp"
2645 break;
2646
2647 case 13:
2648 #line 371 "src/compiler/glsl/glsl_parser.yy"
2649 {
2650 void *mem_ctx = state->linalloc;
2651 (yyval.node) = new(mem_ctx) ast_warnings_toggle(false);
2652 }
2653 #line 2654 "src/compiler/glsl/glsl_parser.cpp"
2654 break;
2655
2656 case 19:
2657 #line 390 "src/compiler/glsl/glsl_parser.yy"
2658 {
2659 if (!_mesa_glsl_process_extension((yyvsp[-3].identifier), & (yylsp[-3]), (yyvsp[-1].identifier), & (yylsp[-1]), state)) {
2660 YYERROR;
2661 }
2662 }
2663 #line 2664 "src/compiler/glsl/glsl_parser.cpp"
2664 break;
2665
2666 case 20:
2667 #line 399 "src/compiler/glsl/glsl_parser.yy"
2668 {
2669 /* FINISHME: The NULL test is required because pragmas are set to
2670 * FINISHME: NULL. (See production rule for external_declaration.)
2671 */
2672 if ((yyvsp[0].node) != NULL)
2673 state->translation_unit.push_tail(& (yyvsp[0].node)->link);
2674 }
2675 #line 2676 "src/compiler/glsl/glsl_parser.cpp"
2676 break;
2677
2678 case 21:
2679 #line 407 "src/compiler/glsl/glsl_parser.yy"
2680 {
2681 /* FINISHME: The NULL test is required because pragmas are set to
2682 * FINISHME: NULL. (See production rule for external_declaration.)
2683 */
2684 if ((yyvsp[0].node) != NULL)
2685 state->translation_unit.push_tail(& (yyvsp[0].node)->link);
2686 }
2687 #line 2688 "src/compiler/glsl/glsl_parser.cpp"
2688 break;
2689
2690 case 22:
2691 #line 414 "src/compiler/glsl/glsl_parser.yy"
2692 {
2693 if (!state->allow_extension_directive_midshader) {
2694 _mesa_glsl_error(& (yylsp[0]), state,
2695 "#extension directive is not allowed "
2696 "in the middle of a shader");
2697 YYERROR;
2698 }
2699 }
2700 #line 2701 "src/compiler/glsl/glsl_parser.cpp"
2701 break;
2702
2703 case 25:
2704 #line 431 "src/compiler/glsl/glsl_parser.yy"
2705 {
2706 void *ctx = state->linalloc;
2707 (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL);
2708 (yyval.expression)->set_location((yylsp[0]));
2709 (yyval.expression)->primary_expression.identifier = (yyvsp[0].identifier);
2710 }
2711 #line 2712 "src/compiler/glsl/glsl_parser.cpp"
2712 break;
2713
2714 case 26:
2715 #line 438 "src/compiler/glsl/glsl_parser.yy"
2716 {
2717 void *ctx = state->linalloc;
2718 (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL);
2719 (yyval.expression)->set_location((yylsp[0]));
2720 (yyval.expression)->primary_expression.int_constant = (yyvsp[0].n);
2721 }
2722 #line 2723 "src/compiler/glsl/glsl_parser.cpp"
2723 break;
2724
2725 case 27:
2726 #line 445 "src/compiler/glsl/glsl_parser.yy"
2727 {
2728 void *ctx = state->linalloc;
2729 (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL);
2730 (yyval.expression)->set_location((yylsp[0]));
2731 (yyval.expression)->primary_expression.uint_constant = (yyvsp[0].n);
2732 }
2733 #line 2734 "src/compiler/glsl/glsl_parser.cpp"
2734 break;
2735
2736 case 28:
2737 #line 452 "src/compiler/glsl/glsl_parser.yy"
2738 {
2739 void *ctx = state->linalloc;
2740 (yyval.expression) = new(ctx) ast_expression(ast_int64_constant, NULL, NULL, NULL);
2741 (yyval.expression)->set_location((yylsp[0]));
2742 (yyval.expression)->primary_expression.int64_constant = (yyvsp[0].n64);
2743 }
2744 #line 2745 "src/compiler/glsl/glsl_parser.cpp"
2745 break;
2746
2747 case 29:
2748 #line 459 "src/compiler/glsl/glsl_parser.yy"
2749 {
2750 void *ctx = state->linalloc;
2751 (yyval.expression) = new(ctx) ast_expression(ast_uint64_constant, NULL, NULL, NULL);
2752 (yyval.expression)->set_location((yylsp[0]));
2753 (yyval.expression)->primary_expression.uint64_constant = (yyvsp[0].n64);
2754 }
2755 #line 2756 "src/compiler/glsl/glsl_parser.cpp"
2756 break;
2757
2758 case 30:
2759 #line 466 "src/compiler/glsl/glsl_parser.yy"
2760 {
2761 void *ctx = state->linalloc;
2762 (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL);
2763 (yyval.expression)->set_location((yylsp[0]));
2764 (yyval.expression)->primary_expression.float_constant = (yyvsp[0].real);
2765 }
2766 #line 2767 "src/compiler/glsl/glsl_parser.cpp"
2767 break;
2768
2769 case 31:
2770 #line 473 "src/compiler/glsl/glsl_parser.yy"
2771 {
2772 void *ctx = state->linalloc;
2773 (yyval.expression) = new(ctx) ast_expression(ast_double_constant, NULL, NULL, NULL);
2774 (yyval.expression)->set_location((yylsp[0]));
2775 (yyval.expression)->primary_expression.double_constant = (yyvsp[0].dreal);
2776 }
2777 #line 2778 "src/compiler/glsl/glsl_parser.cpp"
2778 break;
2779
2780 case 32:
2781 #line 480 "src/compiler/glsl/glsl_parser.yy"
2782 {
2783 void *ctx = state->linalloc;
2784 (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL);
2785 (yyval.expression)->set_location((yylsp[0]));
2786 (yyval.expression)->primary_expression.bool_constant = (yyvsp[0].n);
2787 }
2788 #line 2789 "src/compiler/glsl/glsl_parser.cpp"
2789 break;
2790
2791 case 33:
2792 #line 487 "src/compiler/glsl/glsl_parser.yy"
2793 {
2794 (yyval.expression) = (yyvsp[-1].expression);
2795 }
2796 #line 2797 "src/compiler/glsl/glsl_parser.cpp"
2797 break;
2798
2799 case 35:
2800 #line 495 "src/compiler/glsl/glsl_parser.yy"
2801 {
2802 void *ctx = state->linalloc;
2803 (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[-3].expression), (yyvsp[-1].expression), NULL);
2804 (yyval.expression)->set_location_range((yylsp[-3]), (yylsp[0]));
2805 }
2806 #line 2807 "src/compiler/glsl/glsl_parser.cpp"
2807 break;
2808
2809 case 36:
2810 #line 501 "src/compiler/glsl/glsl_parser.yy"
2811 {
2812 (yyval.expression) = (yyvsp[0].expression);
2813 }
2814 #line 2815 "src/compiler/glsl/glsl_parser.cpp"
2815 break;
2816
2817 case 37:
2818 #line 505 "src/compiler/glsl/glsl_parser.yy"
2819 {
2820 void *ctx = state->linalloc;
2821 (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[-2].expression), NULL, NULL);
2822 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
2823 (yyval.expression)->primary_expression.identifier = (yyvsp[0].identifier);
2824 }
2825 #line 2826 "src/compiler/glsl/glsl_parser.cpp"
2826 break;
2827
2828 case 38:
2829 #line 512 "src/compiler/glsl/glsl_parser.yy"
2830 {
2831 void *ctx = state->linalloc;
2832 (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[-1].expression), NULL, NULL);
2833 (yyval.expression)->set_location_range((yylsp[-1]), (yylsp[0]));
2834 }
2835 #line 2836 "src/compiler/glsl/glsl_parser.cpp"
2836 break;
2837
2838 case 39:
2839 #line 518 "src/compiler/glsl/glsl_parser.yy"
2840 {
2841 void *ctx = state->linalloc;
2842 (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[-1].expression), NULL, NULL);
2843 (yyval.expression)->set_location_range((yylsp[-1]), (yylsp[0]));
2844 }
2845 #line 2846 "src/compiler/glsl/glsl_parser.cpp"
2846 break;
2847
2848 case 47:
2849 #line 549 "src/compiler/glsl/glsl_parser.yy"
2850 {
2851 (yyval.expression) = (yyvsp[-1].expression);
2852 (yyval.expression)->set_location((yylsp[-1]));
2853 (yyval.expression)->expressions.push_tail(& (yyvsp[0].expression)->link);
2854 }
2855 #line 2856 "src/compiler/glsl/glsl_parser.cpp"
2856 break;
2857
2858 case 48:
2859 #line 555 "src/compiler/glsl/glsl_parser.yy"
2860 {
2861 (yyval.expression) = (yyvsp[-2].expression);
2862 (yyval.expression)->set_location((yylsp[-2]));
2863 (yyval.expression)->expressions.push_tail(& (yyvsp[0].expression)->link);
2864 }
2865 #line 2866 "src/compiler/glsl/glsl_parser.cpp"
2866 break;
2867
2868 case 50:
2869 #line 571 "src/compiler/glsl/glsl_parser.yy"
2870 {
2871 void *ctx = state->linalloc;
2872 (yyval.expression) = new(ctx) ast_function_expression((yyvsp[0].type_specifier));
2873 (yyval.expression)->set_location((yylsp[0]));
2874 }
2875 #line 2876 "src/compiler/glsl/glsl_parser.cpp"
2876 break;
2877
2878 case 51:
2879 #line 577 "src/compiler/glsl/glsl_parser.yy"
2880 {
2881 void *ctx = state->linalloc;
2882 (yyval.expression) = new(ctx) ast_function_expression((yyvsp[0].expression));
2883 (yyval.expression)->set_location((yylsp[0]));
2884 }
2885 #line 2886 "src/compiler/glsl/glsl_parser.cpp"
2886 break;
2887
2888 case 53:
2889 #line 592 "src/compiler/glsl/glsl_parser.yy"
2890 {
2891 void *ctx = state->linalloc;
2892 (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[0].expression), NULL, NULL);
2893 (yyval.expression)->set_location((yylsp[-1]));
2894 }
2895 #line 2896 "src/compiler/glsl/glsl_parser.cpp"
2896 break;
2897
2898 case 54:
2899 #line 598 "src/compiler/glsl/glsl_parser.yy"
2900 {
2901 void *ctx = state->linalloc;
2902 (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[0].expression), NULL, NULL);
2903 (yyval.expression)->set_location((yylsp[-1]));
2904 }
2905 #line 2906 "src/compiler/glsl/glsl_parser.cpp"
2906 break;
2907
2908 case 55:
2909 #line 604 "src/compiler/glsl/glsl_parser.yy"
2910 {
2911 void *ctx = state->linalloc;
2912 (yyval.expression) = new(ctx) ast_expression((yyvsp[-1].n), (yyvsp[0].expression), NULL, NULL);
2913 (yyval.expression)->set_location_range((yylsp[-1]), (yylsp[0]));
2914 }
2915 #line 2916 "src/compiler/glsl/glsl_parser.cpp"
2916 break;
2917
2918 case 56:
2919 #line 613 "src/compiler/glsl/glsl_parser.yy"
2920 { (yyval.n) = ast_plus; }
2921 #line 2922 "src/compiler/glsl/glsl_parser.cpp"
2922 break;
2923
2924 case 57:
2925 #line 614 "src/compiler/glsl/glsl_parser.yy"
2926 { (yyval.n) = ast_neg; }
2927 #line 2928 "src/compiler/glsl/glsl_parser.cpp"
2928 break;
2929
2930 case 58:
2931 #line 615 "src/compiler/glsl/glsl_parser.yy"
2932 { (yyval.n) = ast_logic_not; }
2933 #line 2934 "src/compiler/glsl/glsl_parser.cpp"
2934 break;
2935
2936 case 59:
2937 #line 616 "src/compiler/glsl/glsl_parser.yy"
2938 { (yyval.n) = ast_bit_not; }
2939 #line 2940 "src/compiler/glsl/glsl_parser.cpp"
2940 break;
2941
2942 case 61:
2943 #line 622 "src/compiler/glsl/glsl_parser.yy"
2944 {
2945 void *ctx = state->linalloc;
2946 (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[-2].expression), (yyvsp[0].expression));
2947 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
2948 }
2949 #line 2950 "src/compiler/glsl/glsl_parser.cpp"
2950 break;
2951
2952 case 62:
2953 #line 628 "src/compiler/glsl/glsl_parser.yy"
2954 {
2955 void *ctx = state->linalloc;
2956 (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[-2].expression), (yyvsp[0].expression));
2957 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
2958 }
2959 #line 2960 "src/compiler/glsl/glsl_parser.cpp"
2960 break;
2961
2962 case 63:
2963 #line 634 "src/compiler/glsl/glsl_parser.yy"
2964 {
2965 void *ctx = state->linalloc;
2966 (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[-2].expression), (yyvsp[0].expression));
2967 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
2968 }
2969 #line 2970 "src/compiler/glsl/glsl_parser.cpp"
2970 break;
2971
2972 case 65:
2973 #line 644 "src/compiler/glsl/glsl_parser.yy"
2974 {
2975 void *ctx = state->linalloc;
2976 (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[-2].expression), (yyvsp[0].expression));
2977 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
2978 }
2979 #line 2980 "src/compiler/glsl/glsl_parser.cpp"
2980 break;
2981
2982 case 66:
2983 #line 650 "src/compiler/glsl/glsl_parser.yy"
2984 {
2985 void *ctx = state->linalloc;
2986 (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[-2].expression), (yyvsp[0].expression));
2987 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
2988 }
2989 #line 2990 "src/compiler/glsl/glsl_parser.cpp"
2990 break;
2991
2992 case 68:
2993 #line 660 "src/compiler/glsl/glsl_parser.yy"
2994 {
2995 void *ctx = state->linalloc;
2996 (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[-2].expression), (yyvsp[0].expression));
2997 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
2998 }
2999 #line 3000 "src/compiler/glsl/glsl_parser.cpp"
3000 break;
3001
3002 case 69:
3003 #line 666 "src/compiler/glsl/glsl_parser.yy"
3004 {
3005 void *ctx = state->linalloc;
3006 (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[-2].expression), (yyvsp[0].expression));
3007 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3008 }
3009 #line 3010 "src/compiler/glsl/glsl_parser.cpp"
3010 break;
3011
3012 case 71:
3013 #line 676 "src/compiler/glsl/glsl_parser.yy"
3014 {
3015 void *ctx = state->linalloc;
3016 (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[-2].expression), (yyvsp[0].expression));
3017 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3018 }
3019 #line 3020 "src/compiler/glsl/glsl_parser.cpp"
3020 break;
3021
3022 case 72:
3023 #line 682 "src/compiler/glsl/glsl_parser.yy"
3024 {
3025 void *ctx = state->linalloc;
3026 (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[-2].expression), (yyvsp[0].expression));
3027 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3028 }
3029 #line 3030 "src/compiler/glsl/glsl_parser.cpp"
3030 break;
3031
3032 case 73:
3033 #line 688 "src/compiler/glsl/glsl_parser.yy"
3034 {
3035 void *ctx = state->linalloc;
3036 (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[-2].expression), (yyvsp[0].expression));
3037 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3038 }
3039 #line 3040 "src/compiler/glsl/glsl_parser.cpp"
3040 break;
3041
3042 case 74:
3043 #line 694 "src/compiler/glsl/glsl_parser.yy"
3044 {
3045 void *ctx = state->linalloc;
3046 (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[-2].expression), (yyvsp[0].expression));
3047 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3048 }
3049 #line 3050 "src/compiler/glsl/glsl_parser.cpp"
3050 break;
3051
3052 case 76:
3053 #line 704 "src/compiler/glsl/glsl_parser.yy"
3054 {
3055 void *ctx = state->linalloc;
3056 (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[-2].expression), (yyvsp[0].expression));
3057 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3058 }
3059 #line 3060 "src/compiler/glsl/glsl_parser.cpp"
3060 break;
3061
3062 case 77:
3063 #line 710 "src/compiler/glsl/glsl_parser.yy"
3064 {
3065 void *ctx = state->linalloc;
3066 (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[-2].expression), (yyvsp[0].expression));
3067 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3068 }
3069 #line 3070 "src/compiler/glsl/glsl_parser.cpp"
3070 break;
3071
3072 case 79:
3073 #line 720 "src/compiler/glsl/glsl_parser.yy"
3074 {
3075 void *ctx = state->linalloc;
3076 (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_and, (yyvsp[-2].expression), (yyvsp[0].expression));
3077 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3078 }
3079 #line 3080 "src/compiler/glsl/glsl_parser.cpp"
3080 break;
3081
3082 case 81:
3083 #line 730 "src/compiler/glsl/glsl_parser.yy"
3084 {
3085 void *ctx = state->linalloc;
3086 (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[-2].expression), (yyvsp[0].expression));
3087 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3088 }
3089 #line 3090 "src/compiler/glsl/glsl_parser.cpp"
3090 break;
3091
3092 case 83:
3093 #line 740 "src/compiler/glsl/glsl_parser.yy"
3094 {
3095 void *ctx = state->linalloc;
3096 (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[-2].expression), (yyvsp[0].expression));
3097 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3098 }
3099 #line 3100 "src/compiler/glsl/glsl_parser.cpp"
3100 break;
3101
3102 case 85:
3103 #line 750 "src/compiler/glsl/glsl_parser.yy"
3104 {
3105 void *ctx = state->linalloc;
3106 (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[-2].expression), (yyvsp[0].expression));
3107 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3108 }
3109 #line 3110 "src/compiler/glsl/glsl_parser.cpp"
3110 break;
3111
3112 case 87:
3113 #line 760 "src/compiler/glsl/glsl_parser.yy"
3114 {
3115 void *ctx = state->linalloc;
3116 (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[-2].expression), (yyvsp[0].expression));
3117 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3118 }
3119 #line 3120 "src/compiler/glsl/glsl_parser.cpp"
3120 break;
3121
3122 case 89:
3123 #line 770 "src/compiler/glsl/glsl_parser.yy"
3124 {
3125 void *ctx = state->linalloc;
3126 (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[-2].expression), (yyvsp[0].expression));
3127 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3128 }
3129 #line 3130 "src/compiler/glsl/glsl_parser.cpp"
3130 break;
3131
3132 case 91:
3133 #line 780 "src/compiler/glsl/glsl_parser.yy"
3134 {
3135 void *ctx = state->linalloc;
3136 (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[-4].expression), (yyvsp[-2].expression), (yyvsp[0].expression));
3137 (yyval.expression)->set_location_range((yylsp[-4]), (yylsp[0]));
3138 }
3139 #line 3140 "src/compiler/glsl/glsl_parser.cpp"
3140 break;
3141
3142 case 93:
3143 #line 790 "src/compiler/glsl/glsl_parser.yy"
3144 {
3145 void *ctx = state->linalloc;
3146 (yyval.expression) = new(ctx) ast_expression((yyvsp[-1].n), (yyvsp[-2].expression), (yyvsp[0].expression), NULL);
3147 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3148 }
3149 #line 3150 "src/compiler/glsl/glsl_parser.cpp"
3150 break;
3151
3152 case 94:
3153 #line 798 "src/compiler/glsl/glsl_parser.yy"
3154 { (yyval.n) = ast_assign; }
3155 #line 3156 "src/compiler/glsl/glsl_parser.cpp"
3156 break;
3157
3158 case 95:
3159 #line 799 "src/compiler/glsl/glsl_parser.yy"
3160 { (yyval.n) = ast_mul_assign; }
3161 #line 3162 "src/compiler/glsl/glsl_parser.cpp"
3162 break;
3163
3164 case 96:
3165 #line 800 "src/compiler/glsl/glsl_parser.yy"
3166 { (yyval.n) = ast_div_assign; }
3167 #line 3168 "src/compiler/glsl/glsl_parser.cpp"
3168 break;
3169
3170 case 97:
3171 #line 801 "src/compiler/glsl/glsl_parser.yy"
3172 { (yyval.n) = ast_mod_assign; }
3173 #line 3174 "src/compiler/glsl/glsl_parser.cpp"
3174 break;
3175
3176 case 98:
3177 #line 802 "src/compiler/glsl/glsl_parser.yy"
3178 { (yyval.n) = ast_add_assign; }
3179 #line 3180 "src/compiler/glsl/glsl_parser.cpp"
3180 break;
3181
3182 case 99:
3183 #line 803 "src/compiler/glsl/glsl_parser.yy"
3184 { (yyval.n) = ast_sub_assign; }
3185 #line 3186 "src/compiler/glsl/glsl_parser.cpp"
3186 break;
3187
3188 case 100:
3189 #line 804 "src/compiler/glsl/glsl_parser.yy"
3190 { (yyval.n) = ast_ls_assign; }
3191 #line 3192 "src/compiler/glsl/glsl_parser.cpp"
3192 break;
3193
3194 case 101:
3195 #line 805 "src/compiler/glsl/glsl_parser.yy"
3196 { (yyval.n) = ast_rs_assign; }
3197 #line 3198 "src/compiler/glsl/glsl_parser.cpp"
3198 break;
3199
3200 case 102:
3201 #line 806 "src/compiler/glsl/glsl_parser.yy"
3202 { (yyval.n) = ast_and_assign; }
3203 #line 3204 "src/compiler/glsl/glsl_parser.cpp"
3204 break;
3205
3206 case 103:
3207 #line 807 "src/compiler/glsl/glsl_parser.yy"
3208 { (yyval.n) = ast_xor_assign; }
3209 #line 3210 "src/compiler/glsl/glsl_parser.cpp"
3210 break;
3211
3212 case 104:
3213 #line 808 "src/compiler/glsl/glsl_parser.yy"
3214 { (yyval.n) = ast_or_assign; }
3215 #line 3216 "src/compiler/glsl/glsl_parser.cpp"
3216 break;
3217
3218 case 105:
3219 #line 813 "src/compiler/glsl/glsl_parser.yy"
3220 {
3221 (yyval.expression) = (yyvsp[0].expression);
3222 }
3223 #line 3224 "src/compiler/glsl/glsl_parser.cpp"
3224 break;
3225
3226 case 106:
3227 #line 817 "src/compiler/glsl/glsl_parser.yy"
3228 {
3229 void *ctx = state->linalloc;
3230 if ((yyvsp[-2].expression)->oper != ast_sequence) {
3231 (yyval.expression) = new(ctx) ast_expression(ast_sequence, NULL, NULL, NULL);
3232 (yyval.expression)->set_location_range((yylsp[-2]), (yylsp[0]));
3233 (yyval.expression)->expressions.push_tail(& (yyvsp[-2].expression)->link);
3234 } else {
3235 (yyval.expression) = (yyvsp[-2].expression);
3236 }
3237
3238 (yyval.expression)->expressions.push_tail(& (yyvsp[0].expression)->link);
3239 }
3240 #line 3241 "src/compiler/glsl/glsl_parser.cpp"
3241 break;
3242
3243 case 108:
3244 #line 837 "src/compiler/glsl/glsl_parser.yy"
3245 {
3246 state->symbols->pop_scope();
3247 (yyval.node) = (yyvsp[-1].function);
3248 }
3249 #line 3250 "src/compiler/glsl/glsl_parser.cpp"
3250 break;
3251
3252 case 109:
3253 #line 842 "src/compiler/glsl/glsl_parser.yy"
3254 {
3255 (yyval.node) = (yyvsp[-1].declarator_list);
3256 }
3257 #line 3258 "src/compiler/glsl/glsl_parser.cpp"
3258 break;
3259
3260 case 110:
3261 #line 846 "src/compiler/glsl/glsl_parser.yy"
3262 {
3263 (yyvsp[-1].type_specifier)->default_precision = (yyvsp[-2].n);
3264 (yyval.node) = (yyvsp[-1].type_specifier);
3265 }
3266 #line 3267 "src/compiler/glsl/glsl_parser.cpp"
3267 break;
3268
3269 case 111:
3270 #line 851 "src/compiler/glsl/glsl_parser.yy"
3271 {
3272 ast_interface_block *block = (ast_interface_block *) (yyvsp[0].node);
3273 if (block->layout.has_layout() || block->layout.has_memory()) {
3274 if (!block->default_layout.merge_qualifier(& (yylsp[0]), state, block->layout, false)) {
3275 YYERROR;
3276 }
3277 }
3278 block->layout = block->default_layout;
3279 if (!block->layout.push_to_global(& (yylsp[0]), state)) {
3280 YYERROR;
3281 }
3282 (yyval.node) = (yyvsp[0].node);
3283 }
3284 #line 3285 "src/compiler/glsl/glsl_parser.cpp"
3285 break;
3286
3287 case 115:
3288 #line 877 "src/compiler/glsl/glsl_parser.yy"
3289 {
3290 (yyval.function) = (yyvsp[-1].function);
3291 (yyval.function)->parameters.push_tail(& (yyvsp[0].parameter_declarator)->link);
3292 }
3293 #line 3294 "src/compiler/glsl/glsl_parser.cpp"
3294 break;
3295
3296 case 116:
3297 #line 882 "src/compiler/glsl/glsl_parser.yy"
3298 {
3299 (yyval.function) = (yyvsp[-2].function);
3300 (yyval.function)->parameters.push_tail(& (yyvsp[0].parameter_declarator)->link);
3301 }
3302 #line 3303 "src/compiler/glsl/glsl_parser.cpp"
3303 break;
3304
3305 case 117:
3306 #line 890 "src/compiler/glsl/glsl_parser.yy"
3307 {
3308 void *ctx = state->linalloc;
3309 (yyval.function) = new(ctx) ast_function();
3310 (yyval.function)->set_location((yylsp[-1]));
3311 (yyval.function)->return_type = (yyvsp[-2].fully_specified_type);
3312 (yyval.function)->identifier = (yyvsp[-1].identifier);
3313
3314 if ((yyvsp[-2].fully_specified_type)->qualifier.is_subroutine_decl()) {
3315 /* add type for IDENTIFIER search */
3316 state->symbols->add_type((yyvsp[-1].identifier), glsl_type::get_subroutine_instance((yyvsp[-1].identifier)));
3317 } else
3318 state->symbols->add_function(new(state) ir_function((yyvsp[-1].identifier)));
3319 state->symbols->push_scope();
3320 }
3321 #line 3322 "src/compiler/glsl/glsl_parser.cpp"
3322 break;
3323
3324 case 118:
3325 #line 908 "src/compiler/glsl/glsl_parser.yy"
3326 {
3327 void *ctx = state->linalloc;
3328 (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
3329 (yyval.parameter_declarator)->set_location_range((yylsp[-1]), (yylsp[0]));
3330 (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type();
3331 (yyval.parameter_declarator)->type->set_location((yylsp[-1]));
3332 (yyval.parameter_declarator)->type->specifier = (yyvsp[-1].type_specifier);
3333 (yyval.parameter_declarator)->identifier = (yyvsp[0].identifier);
3334 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[0].identifier), ir_var_auto));
3335 }
3336 #line 3337 "src/compiler/glsl/glsl_parser.cpp"
3337 break;
3338
3339 case 119:
3340 #line 919 "src/compiler/glsl/glsl_parser.yy"
3341 {
3342 if (state->allow_layout_qualifier_on_function_parameter) {
3343 void *ctx = state->linalloc;
3344 (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
3345 (yyval.parameter_declarator)->set_location_range((yylsp[-1]), (yylsp[0]));
3346 (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type();
3347 (yyval.parameter_declarator)->type->set_location((yylsp[-1]));
3348 (yyval.parameter_declarator)->type->specifier = (yyvsp[-1].type_specifier);
3349 (yyval.parameter_declarator)->identifier = (yyvsp[0].identifier);
3350 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[0].identifier), ir_var_auto));
3351 } else {
3352 _mesa_glsl_error(&(yylsp[-2]), state,
3353 "is is not allowed on function parameter");
3354 YYERROR;
3355 }
3356 }
3357 #line 3358 "src/compiler/glsl/glsl_parser.cpp"
3358 break;
3359
3360 case 120:
3361 #line 936 "src/compiler/glsl/glsl_parser.yy"
3362 {
3363 void *ctx = state->linalloc;
3364 (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
3365 (yyval.parameter_declarator)->set_location_range((yylsp[-2]), (yylsp[0]));
3366 (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type();
3367 (yyval.parameter_declarator)->type->set_location((yylsp[-2]));
3368 (yyval.parameter_declarator)->type->specifier = (yyvsp[-2].type_specifier);
3369 (yyval.parameter_declarator)->identifier = (yyvsp[-1].identifier);
3370 (yyval.parameter_declarator)->array_specifier = (yyvsp[0].array_specifier);
3371 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[-1].identifier), ir_var_auto));
3372 }
3373 #line 3374 "src/compiler/glsl/glsl_parser.cpp"
3374 break;
3375
3376 case 121:
3377 #line 951 "src/compiler/glsl/glsl_parser.yy"
3378 {
3379 (yyval.parameter_declarator) = (yyvsp[0].parameter_declarator);
3380 (yyval.parameter_declarator)->type->qualifier = (yyvsp[-1].type_qualifier);
3381 if (!(yyval.parameter_declarator)->type->qualifier.push_to_global(& (yylsp[-1]), state)) {
3382 YYERROR;
3383 }
3384 }
3385 #line 3386 "src/compiler/glsl/glsl_parser.cpp"
3386 break;
3387
3388 case 122:
3389 #line 959 "src/compiler/glsl/glsl_parser.yy"
3390 {
3391 void *ctx = state->linalloc;
3392 (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
3393 (yyval.parameter_declarator)->set_location((yylsp[0]));
3394 (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type();
3395 (yyval.parameter_declarator)->type->set_location_range((yylsp[-1]), (yylsp[0]));
3396 (yyval.parameter_declarator)->type->qualifier = (yyvsp[-1].type_qualifier);
3397 if (!(yyval.parameter_declarator)->type->qualifier.push_to_global(& (yylsp[-1]), state)) {
3398 YYERROR;
3399 }
3400 (yyval.parameter_declarator)->type->specifier = (yyvsp[0].type_specifier);
3401 }
3402 #line 3403 "src/compiler/glsl/glsl_parser.cpp"
3403 break;
3404
3405 case 123:
3406 #line 975 "src/compiler/glsl/glsl_parser.yy"
3407 {
3408 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
3409 }
3410 #line 3411 "src/compiler/glsl/glsl_parser.cpp"
3411 break;
3412
3413 case 124:
3414 #line 979 "src/compiler/glsl/glsl_parser.yy"
3415 {
3416 if ((yyvsp[0].type_qualifier).flags.q.constant)
3417 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate const qualifier");
3418
3419 (yyval.type_qualifier) = (yyvsp[0].type_qualifier);
3420 (yyval.type_qualifier).flags.q.constant = 1;
3421 }
3422 #line 3423 "src/compiler/glsl/glsl_parser.cpp"
3423 break;
3424
3425 case 125:
3426 #line 987 "src/compiler/glsl/glsl_parser.yy"
3427 {
3428 if ((yyvsp[0].type_qualifier).flags.q.precise)
3429 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate precise qualifier");
3430
3431 (yyval.type_qualifier) = (yyvsp[0].type_qualifier);
3432 (yyval.type_qualifier).flags.q.precise = 1;
3433 }
3434 #line 3435 "src/compiler/glsl/glsl_parser.cpp"
3435 break;
3436
3437 case 126:
3438 #line 995 "src/compiler/glsl/glsl_parser.yy"
3439 {
3440 if (((yyvsp[-1].type_qualifier).flags.q.in || (yyvsp[-1].type_qualifier).flags.q.out) && ((yyvsp[0].type_qualifier).flags.q.in || (yyvsp[0].type_qualifier).flags.q.out))
3441 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate in/out/inout qualifier");
3442
3443 if (!state->has_420pack_or_es31() && (yyvsp[0].type_qualifier).flags.q.constant)
3444 _mesa_glsl_error(&(yylsp[-1]), state, "in/out/inout must come after const "
3445 "or precise");
3446
3447 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
3448 (yyval.type_qualifier).merge_qualifier(&(yylsp[-1]), state, (yyvsp[0].type_qualifier), false);
3449 }
3450 #line 3451 "src/compiler/glsl/glsl_parser.cpp"
3451 break;
3452
3453 case 127:
3454 #line 1007 "src/compiler/glsl/glsl_parser.yy"
3455 {
3456 if ((yyvsp[0].type_qualifier).precision != ast_precision_none)
3457 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate precision qualifier");
3458
3459 if (!state->has_420pack_or_es31() &&
3460 (yyvsp[0].type_qualifier).flags.i != 0)
3461 _mesa_glsl_error(&(yylsp[-1]), state, "precision qualifiers must come last");
3462
3463 (yyval.type_qualifier) = (yyvsp[0].type_qualifier);
3464 (yyval.type_qualifier).precision = (yyvsp[-1].n);
3465 }
3466 #line 3467 "src/compiler/glsl/glsl_parser.cpp"
3467 break;
3468
3469 case 128:
3470 #line 1019 "src/compiler/glsl/glsl_parser.yy"
3471 {
3472 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
3473 (yyval.type_qualifier).merge_qualifier(&(yylsp[-1]), state, (yyvsp[0].type_qualifier), false);
3474 }
3475 #line 3476 "src/compiler/glsl/glsl_parser.cpp"
3476 break;
3477
3478 case 129:
3479 #line 1026 "src/compiler/glsl/glsl_parser.yy"
3480 {
3481 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
3482 (yyval.type_qualifier).flags.q.in = 1;
3483 }
3484 #line 3485 "src/compiler/glsl/glsl_parser.cpp"
3485 break;
3486
3487 case 130:
3488 #line 1031 "src/compiler/glsl/glsl_parser.yy"
3489 {
3490 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
3491 (yyval.type_qualifier).flags.q.out = 1;
3492 }
3493 #line 3494 "src/compiler/glsl/glsl_parser.cpp"
3494 break;
3495
3496 case 131:
3497 #line 1036 "src/compiler/glsl/glsl_parser.yy"
3498 {
3499 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
3500 (yyval.type_qualifier).flags.q.in = 1;
3501 (yyval.type_qualifier).flags.q.out = 1;
3502 }
3503 #line 3504 "src/compiler/glsl/glsl_parser.cpp"
3504 break;
3505
3506 case 134:
3507 #line 1050 "src/compiler/glsl/glsl_parser.yy"
3508 {
3509 void *ctx = state->linalloc;
3510 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[0].identifier), NULL, NULL);
3511 decl->set_location((yylsp[0]));
3512
3513 (yyval.declarator_list) = (yyvsp[-2].declarator_list);
3514 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3515 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[0].identifier), ir_var_auto));
3516 }
3517 #line 3518 "src/compiler/glsl/glsl_parser.cpp"
3518 break;
3519
3520 case 135:
3521 #line 1060 "src/compiler/glsl/glsl_parser.yy"
3522 {
3523 void *ctx = state->linalloc;
3524 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[-1].identifier), (yyvsp[0].array_specifier), NULL);
3525 decl->set_location_range((yylsp[-1]), (yylsp[0]));
3526
3527 (yyval.declarator_list) = (yyvsp[-3].declarator_list);
3528 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3529 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[-1].identifier), ir_var_auto));
3530 }
3531 #line 3532 "src/compiler/glsl/glsl_parser.cpp"
3532 break;
3533
3534 case 136:
3535 #line 1070 "src/compiler/glsl/glsl_parser.yy"
3536 {
3537 void *ctx = state->linalloc;
3538 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[-3].identifier), (yyvsp[-2].array_specifier), (yyvsp[0].expression));
3539 decl->set_location_range((yylsp[-3]), (yylsp[-2]));
3540
3541 (yyval.declarator_list) = (yyvsp[-5].declarator_list);
3542 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3543 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[-3].identifier), ir_var_auto));
3544 }
3545 #line 3546 "src/compiler/glsl/glsl_parser.cpp"
3546 break;
3547
3548 case 137:
3549 #line 1080 "src/compiler/glsl/glsl_parser.yy"
3550 {
3551 void *ctx = state->linalloc;
3552 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[-2].identifier), NULL, (yyvsp[0].expression));
3553 decl->set_location((yylsp[-2]));
3554
3555 (yyval.declarator_list) = (yyvsp[-4].declarator_list);
3556 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3557 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[-2].identifier), ir_var_auto));
3558 }
3559 #line 3560 "src/compiler/glsl/glsl_parser.cpp"
3560 break;
3561
3562 case 138:
3563 #line 1094 "src/compiler/glsl/glsl_parser.yy"
3564 {
3565 void *ctx = state->linalloc;
3566 /* Empty declaration list is valid. */
3567 (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[0].fully_specified_type));
3568 (yyval.declarator_list)->set_location((yylsp[0]));
3569 }
3570 #line 3571 "src/compiler/glsl/glsl_parser.cpp"
3571 break;
3572
3573 case 139:
3574 #line 1101 "src/compiler/glsl/glsl_parser.yy"
3575 {
3576 void *ctx = state->linalloc;
3577 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[0].identifier), NULL, NULL);
3578 decl->set_location((yylsp[0]));
3579
3580 (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[-1].fully_specified_type));
3581 (yyval.declarator_list)->set_location_range((yylsp[-1]), (yylsp[0]));
3582 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3583 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[0].identifier), ir_var_auto));
3584 }
3585 #line 3586 "src/compiler/glsl/glsl_parser.cpp"
3586 break;
3587
3588 case 140:
3589 #line 1112 "src/compiler/glsl/glsl_parser.yy"
3590 {
3591 void *ctx = state->linalloc;
3592 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[-1].identifier), (yyvsp[0].array_specifier), NULL);
3593 decl->set_location_range((yylsp[-1]), (yylsp[0]));
3594
3595 (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[-2].fully_specified_type));
3596 (yyval.declarator_list)->set_location_range((yylsp[-2]), (yylsp[0]));
3597 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3598 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[-1].identifier), ir_var_auto));
3599 }
3600 #line 3601 "src/compiler/glsl/glsl_parser.cpp"
3601 break;
3602
3603 case 141:
3604 #line 1123 "src/compiler/glsl/glsl_parser.yy"
3605 {
3606 void *ctx = state->linalloc;
3607 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[-3].identifier), (yyvsp[-2].array_specifier), (yyvsp[0].expression));
3608 decl->set_location_range((yylsp[-3]), (yylsp[-2]));
3609
3610 (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[-4].fully_specified_type));
3611 (yyval.declarator_list)->set_location_range((yylsp[-4]), (yylsp[-2]));
3612 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3613 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[-3].identifier), ir_var_auto));
3614 }
3615 #line 3616 "src/compiler/glsl/glsl_parser.cpp"
3616 break;
3617
3618 case 142:
3619 #line 1134 "src/compiler/glsl/glsl_parser.yy"
3620 {
3621 void *ctx = state->linalloc;
3622 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[-2].identifier), NULL, (yyvsp[0].expression));
3623 decl->set_location((yylsp[-2]));
3624
3625 (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[-3].fully_specified_type));
3626 (yyval.declarator_list)->set_location_range((yylsp[-3]), (yylsp[-2]));
3627 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3628 state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[-2].identifier), ir_var_auto));
3629 }
3630 #line 3631 "src/compiler/glsl/glsl_parser.cpp"
3631 break;
3632
3633 case 143:
3634 #line 1145 "src/compiler/glsl/glsl_parser.yy"
3635 {
3636 void *ctx = state->linalloc;
3637 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[0].identifier), NULL, NULL);
3638 decl->set_location((yylsp[0]));
3639
3640 (yyval.declarator_list) = new(ctx) ast_declarator_list(NULL);
3641 (yyval.declarator_list)->set_location_range((yylsp[-1]), (yylsp[0]));
3642 (yyval.declarator_list)->invariant = true;
3643
3644 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3645 }
3646 #line 3647 "src/compiler/glsl/glsl_parser.cpp"
3647 break;
3648
3649 case 144:
3650 #line 1157 "src/compiler/glsl/glsl_parser.yy"
3651 {
3652 void *ctx = state->linalloc;
3653 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[0].identifier), NULL, NULL);
3654 decl->set_location((yylsp[0]));
3655
3656 (yyval.declarator_list) = new(ctx) ast_declarator_list(NULL);
3657 (yyval.declarator_list)->set_location_range((yylsp[-1]), (yylsp[0]));
3658 (yyval.declarator_list)->precise = true;
3659
3660 (yyval.declarator_list)->declarations.push_tail(&decl->link);
3661 }
3662 #line 3663 "src/compiler/glsl/glsl_parser.cpp"
3663 break;
3664
3665 case 145:
3666 #line 1172 "src/compiler/glsl/glsl_parser.yy"
3667 {
3668 void *ctx = state->linalloc;
3669 (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type();
3670 (yyval.fully_specified_type)->set_location((yylsp[0]));
3671 (yyval.fully_specified_type)->specifier = (yyvsp[0].type_specifier);
3672 }
3673 #line 3674 "src/compiler/glsl/glsl_parser.cpp"
3674 break;
3675
3676 case 146:
3677 #line 1179 "src/compiler/glsl/glsl_parser.yy"
3678 {
3679 void *ctx = state->linalloc;
3680 (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type();
3681 (yyval.fully_specified_type)->set_location_range((yylsp[-1]), (yylsp[0]));
3682 (yyval.fully_specified_type)->qualifier = (yyvsp[-1].type_qualifier);
3683 if (!(yyval.fully_specified_type)->qualifier.push_to_global(& (yylsp[-1]), state)) {
3684 YYERROR;
3685 }
3686 (yyval.fully_specified_type)->specifier = (yyvsp[0].type_specifier);
3687 if ((yyval.fully_specified_type)->specifier->structure != NULL &&
3688 (yyval.fully_specified_type)->specifier->structure->is_declaration) {
3689 (yyval.fully_specified_type)->specifier->structure->layout = &(yyval.fully_specified_type)->qualifier;
3690 }
3691 }
3692 #line 3693 "src/compiler/glsl/glsl_parser.cpp"
3693 break;
3694
3695 case 147:
3696 #line 1197 "src/compiler/glsl/glsl_parser.yy"
3697 {
3698 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
3699 }
3700 #line 3701 "src/compiler/glsl/glsl_parser.cpp"
3701 break;
3702
3703 case 149:
3704 #line 1205 "src/compiler/glsl/glsl_parser.yy"
3705 {
3706 (yyval.type_qualifier) = (yyvsp[-2].type_qualifier);
3707 if (!(yyval.type_qualifier).merge_qualifier(& (yylsp[0]), state, (yyvsp[0].type_qualifier), true)) {
3708 YYERROR;
3709 }
3710 }
3711 #line 3712 "src/compiler/glsl/glsl_parser.cpp"
3712 break;
3713
3714 case 150:
3715 #line 1215 "src/compiler/glsl/glsl_parser.yy"
3716 {
3717 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
3718
3719 /* Layout qualifiers for ARB_fragment_coord_conventions. */
3720 if (!(yyval.type_qualifier).flags.i && (state->ARB_fragment_coord_conventions_enable ||
3721 state->is_version(150, 0))) {
3722 if (match_layout_qualifier((yyvsp[0].identifier), "origin_upper_left", state) == 0) {
3723 (yyval.type_qualifier).flags.q.origin_upper_left = 1;
3724 } else if (match_layout_qualifier((yyvsp[0].identifier), "pixel_center_integer",
3725 state) == 0) {
3726 (yyval.type_qualifier).flags.q.pixel_center_integer = 1;
3727 }
3728
3729 if ((yyval.type_qualifier).flags.i && state->ARB_fragment_coord_conventions_warn) {
3730 _mesa_glsl_warning(& (yylsp[0]), state,
3731 "GL_ARB_fragment_coord_conventions layout "
3732 "identifier `%s' used", (yyvsp[0].identifier));
3733 }
3734 }
3735
3736 /* Layout qualifiers for AMD/ARB_conservative_depth. */
3737 if (!(yyval.type_qualifier).flags.i &&
3738 (state->AMD_conservative_depth_enable ||
3739 state->ARB_conservative_depth_enable ||
3740 state->is_version(420, 0))) {
3741 if (match_layout_qualifier((yyvsp[0].identifier), "depth_any", state) == 0) {
3742 (yyval.type_qualifier).flags.q.depth_type = 1;
3743 (yyval.type_qualifier).depth_type = ast_depth_any;
3744 } else if (match_layout_qualifier((yyvsp[0].identifier), "depth_greater", state) == 0) {
3745 (yyval.type_qualifier).flags.q.depth_type = 1;
3746 (yyval.type_qualifier).depth_type = ast_depth_greater;
3747 } else if (match_layout_qualifier((yyvsp[0].identifier), "depth_less", state) == 0) {
3748 (yyval.type_qualifier).flags.q.depth_type = 1;
3749 (yyval.type_qualifier).depth_type = ast_depth_less;
3750 } else if (match_layout_qualifier((yyvsp[0].identifier), "depth_unchanged",
3751 state) == 0) {
3752 (yyval.type_qualifier).flags.q.depth_type = 1;
3753 (yyval.type_qualifier).depth_type = ast_depth_unchanged;
3754 }
3755
3756 if ((yyval.type_qualifier).flags.i && state->AMD_conservative_depth_warn) {
3757 _mesa_glsl_warning(& (yylsp[0]), state,
3758 "GL_AMD_conservative_depth "
3759 "layout qualifier `%s' is used", (yyvsp[0].identifier));
3760 }
3761 if ((yyval.type_qualifier).flags.i && state->ARB_conservative_depth_warn) {
3762 _mesa_glsl_warning(& (yylsp[0]), state,
3763 "GL_ARB_conservative_depth "
3764 "layout qualifier `%s' is used", (yyvsp[0].identifier));
3765 }
3766 }
3767
3768 /* See also interface_block_layout_qualifier. */
3769 if (!(yyval.type_qualifier).flags.i && state->has_uniform_buffer_objects()) {
3770 if (match_layout_qualifier((yyvsp[0].identifier), "std140", state) == 0) {
3771 (yyval.type_qualifier).flags.q.std140 = 1;
3772 } else if (match_layout_qualifier((yyvsp[0].identifier), "shared", state) == 0) {
3773 (yyval.type_qualifier).flags.q.shared = 1;
3774 } else if (match_layout_qualifier((yyvsp[0].identifier), "std430", state) == 0) {
3775 (yyval.type_qualifier).flags.q.std430 = 1;
3776 } else if (match_layout_qualifier((yyvsp[0].identifier), "column_major", state) == 0) {
3777 (yyval.type_qualifier).flags.q.column_major = 1;
3778 /* "row_major" is a reserved word in GLSL 1.30+. Its token is parsed
3779 * below in the interface_block_layout_qualifier rule.
3780 *
3781 * It is not a reserved word in GLSL ES 3.00, so it's handled here as
3782 * an identifier.
3783 *
3784 * Also, this takes care of alternate capitalizations of
3785 * "row_major" (which is necessary because layout qualifiers
3786 * are case-insensitive in desktop GLSL).
3787 */
3788 } else if (match_layout_qualifier((yyvsp[0].identifier), "row_major", state) == 0) {
3789 (yyval.type_qualifier).flags.q.row_major = 1;
3790 /* "packed" is a reserved word in GLSL, and its token is
3791 * parsed below in the interface_block_layout_qualifier rule.
3792 * However, we must take care of alternate capitalizations of
3793 * "packed", because layout qualifiers are case-insensitive
3794 * in desktop GLSL.
3795 */
3796 } else if (match_layout_qualifier((yyvsp[0].identifier), "packed", state) == 0) {
3797 (yyval.type_qualifier).flags.q.packed = 1;
3798 }
3799
3800 if ((yyval.type_qualifier).flags.i && state->ARB_uniform_buffer_object_warn) {
3801 _mesa_glsl_warning(& (yylsp[0]), state,
3802 "#version 140 / GL_ARB_uniform_buffer_object "
3803 "layout qualifier `%s' is used", (yyvsp[0].identifier));
3804 }
3805 }
3806
3807 /* Layout qualifiers for GLSL 1.50 geometry shaders. */
3808 if (!(yyval.type_qualifier).flags.i) {
3809 static const struct {
3810 const char *s;
3811 GLenum e;
3812 } map[] = {
3813 { "points", GL_POINTS },
3814 { "lines", GL_LINES },
3815 { "lines_adjacency", GL_LINES_ADJACENCY },
3816 { "line_strip", GL_LINE_STRIP },
3817 { "triangles", GL_TRIANGLES },
3818 { "triangles_adjacency", GL_TRIANGLES_ADJACENCY },
3819 { "triangle_strip", GL_TRIANGLE_STRIP },
3820 };
3821 for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
3822 if (match_layout_qualifier((yyvsp[0].identifier), map[i].s, state) == 0) {
3823 (yyval.type_qualifier).flags.q.prim_type = 1;
3824 (yyval.type_qualifier).prim_type = map[i].e;
3825 break;
3826 }
3827 }
3828
3829 if ((yyval.type_qualifier).flags.i && !state->has_geometry_shader() &&
3830 !state->has_tessellation_shader()) {
3831 _mesa_glsl_error(& (yylsp[0]), state, "#version 150 layout "
3832 "qualifier `%s' used", (yyvsp[0].identifier));
3833 }
3834 }
3835
3836 /* Layout qualifiers for ARB_shader_image_load_store. */
3837 if (state->has_shader_image_load_store()) {
3838 if (!(yyval.type_qualifier).flags.i) {
3839 static const struct {
3840 const char *name;
3841 enum pipe_format format;
3842 glsl_base_type base_type;
3843 /** Minimum desktop GLSL version required for the image
3844 * format. Use 130 if already present in the original
3845 * ARB extension.
3846 */
3847 unsigned required_glsl;
3848 /** Minimum GLSL ES version required for the image format. */
3849 unsigned required_essl;
3850 /* NV_image_formats */
3851 bool nv_image_formats;
3852 bool ext_qualifiers;
3853 } map[] = {
3854 { "rgba32f", PIPE_FORMAT_R32G32B32A32_FLOAT, GLSL_TYPE_FLOAT, 130, 310, false, false },
3855 { "rgba16f", PIPE_FORMAT_R16G16B16A16_FLOAT, GLSL_TYPE_FLOAT, 130, 310, false, false },
3856 { "rg32f", PIPE_FORMAT_R32G32_FLOAT, GLSL_TYPE_FLOAT, 130, 0, true, false },
3857 { "rg16f", PIPE_FORMAT_R16G16_FLOAT, GLSL_TYPE_FLOAT, 130, 0, true, false },
3858 { "r11f_g11f_b10f", PIPE_FORMAT_R11G11B10_FLOAT, GLSL_TYPE_FLOAT, 130, 0, true, false },
3859 { "r32f", PIPE_FORMAT_R32_FLOAT, GLSL_TYPE_FLOAT, 130, 310, false, false },
3860 { "r16f", PIPE_FORMAT_R16_FLOAT, GLSL_TYPE_FLOAT, 130, 0, true, false },
3861 { "rgba32ui", PIPE_FORMAT_R32G32B32A32_UINT, GLSL_TYPE_UINT, 130, 310, false, false },
3862 { "rgba16ui", PIPE_FORMAT_R16G16B16A16_UINT, GLSL_TYPE_UINT, 130, 310, false, false },
3863 { "rgb10_a2ui", PIPE_FORMAT_R10G10B10A2_UINT, GLSL_TYPE_UINT, 130, 0, true, false },
3864 { "rgba8ui", PIPE_FORMAT_R8G8B8A8_UINT, GLSL_TYPE_UINT, 130, 310, false, false },
3865 { "rg32ui", PIPE_FORMAT_R32G32_UINT, GLSL_TYPE_UINT, 130, 0, true, false },
3866 { "rg16ui", PIPE_FORMAT_R16G16_UINT, GLSL_TYPE_UINT, 130, 0, true, false },
3867 { "rg8ui", PIPE_FORMAT_R8G8_UINT, GLSL_TYPE_UINT, 130, 0, true, false },
3868 { "r32ui", PIPE_FORMAT_R32_UINT, GLSL_TYPE_UINT, 130, 310, false, false },
3869 { "r16ui", PIPE_FORMAT_R16_UINT, GLSL_TYPE_UINT, 130, 0, true, false },
3870 { "r8ui", PIPE_FORMAT_R8_UINT, GLSL_TYPE_UINT, 130, 0, true, false },
3871 { "rgba32i", PIPE_FORMAT_R32G32B32A32_SINT, GLSL_TYPE_INT, 130, 310, false, false },
3872 { "rgba16i", PIPE_FORMAT_R16G16B16A16_SINT, GLSL_TYPE_INT, 130, 310, false, false },
3873 { "rgba8i", PIPE_FORMAT_R8G8B8A8_SINT, GLSL_TYPE_INT, 130, 310, false, false },
3874 { "rg32i", PIPE_FORMAT_R32G32_SINT, GLSL_TYPE_INT, 130, 0, true, false },
3875 { "rg16i", PIPE_FORMAT_R16G16_SINT, GLSL_TYPE_INT, 130, 0, true, false },
3876 { "rg8i", PIPE_FORMAT_R8G8_SINT, GLSL_TYPE_INT, 130, 0, true, false },
3877 { "r32i", PIPE_FORMAT_R32_SINT, GLSL_TYPE_INT, 130, 310, false, false },
3878 { "r16i", PIPE_FORMAT_R16_SINT, GLSL_TYPE_INT, 130, 0, true, false },
3879 { "r8i", PIPE_FORMAT_R8_SINT, GLSL_TYPE_INT, 130, 0, true, false },
3880 { "rgba16", PIPE_FORMAT_R16G16B16A16_UNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3881 { "rgb10_a2", PIPE_FORMAT_R10G10B10A2_UNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3882 { "rgba8", PIPE_FORMAT_R8G8B8A8_UNORM, GLSL_TYPE_FLOAT, 130, 310, false, false },
3883 { "rg16", PIPE_FORMAT_R16G16_UNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3884 { "rg8", PIPE_FORMAT_R8G8_UNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3885 { "r16", PIPE_FORMAT_R16_UNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3886 { "r8", PIPE_FORMAT_R8_UNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3887 { "rgba16_snorm", PIPE_FORMAT_R16G16B16A16_SNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3888 { "rgba8_snorm", PIPE_FORMAT_R8G8B8A8_SNORM, GLSL_TYPE_FLOAT, 130, 310, false, false },
3889 { "rg16_snorm", PIPE_FORMAT_R16G16_SNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3890 { "rg8_snorm", PIPE_FORMAT_R8G8_SNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3891 { "r16_snorm", PIPE_FORMAT_R16_SNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3892 { "r8_snorm", PIPE_FORMAT_R8_SNORM, GLSL_TYPE_FLOAT, 130, 0, true, false },
3893
3894 /* From GL_EXT_shader_image_load_store: */
3895 /* base_type is incorrect but it'll be patched later when we know
3896 * the variable type. See ast_to_hir.cpp */
3897 { "size1x8", PIPE_FORMAT_R8_SINT, GLSL_TYPE_VOID, 130, 0, false, true },
3898 { "size1x16", PIPE_FORMAT_R16_SINT, GLSL_TYPE_VOID, 130, 0, false, true },
3899 { "size1x32", PIPE_FORMAT_R32_SINT, GLSL_TYPE_VOID, 130, 0, false, true },
3900 { "size2x32", PIPE_FORMAT_R32G32_SINT, GLSL_TYPE_VOID, 130, 0, false, true },
3901 { "size4x32", PIPE_FORMAT_R32G32B32A32_SINT, GLSL_TYPE_VOID, 130, 0, false, true },
3902 };
3903
3904 for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
3905 if ((state->is_version(map[i].required_glsl,
3906 map[i].required_essl) ||
3907 (state->NV_image_formats_enable &&
3908 map[i].nv_image_formats)) &&
3909 match_layout_qualifier((yyvsp[0].identifier), map[i].name, state) == 0) {
3910 /* Skip ARB_shader_image_load_store qualifiers if not enabled */
3911 if (!map[i].ext_qualifiers && !(state->ARB_shader_image_load_store_enable ||
3912 state->is_version(420, 310))) {
3913 continue;
3914 }
3915 /* Skip EXT_shader_image_load_store qualifiers if not enabled */
3916 if (map[i].ext_qualifiers && !state->EXT_shader_image_load_store_enable) {
3917 continue;
3918 }
3919 (yyval.type_qualifier).flags.q.explicit_image_format = 1;
3920 (yyval.type_qualifier).image_format = map[i].format;
3921 (yyval.type_qualifier).image_base_type = map[i].base_type;
3922 break;
3923 }
3924 }
3925 }
3926 }
3927
3928 if (!(yyval.type_qualifier).flags.i) {
3929 if (match_layout_qualifier((yyvsp[0].identifier), "early_fragment_tests", state) == 0) {
3930 /* From section 4.4.1.3 of the GLSL 4.50 specification
3931 * (Fragment Shader Inputs):
3932 *
3933 * "Fragment shaders also allow the following layout
3934 * qualifier on in only (not with variable declarations)
3935 * layout-qualifier-id
3936 * early_fragment_tests
3937 * [...]"
3938 */
3939 if (state->stage != MESA_SHADER_FRAGMENT) {
3940 _mesa_glsl_error(& (yylsp[0]), state,
3941 "early_fragment_tests layout qualifier only "
3942 "valid in fragment shaders");
3943 }
3944
3945 (yyval.type_qualifier).flags.q.early_fragment_tests = 1;
3946 }
3947
3948 if (match_layout_qualifier((yyvsp[0].identifier), "inner_coverage", state) == 0) {
3949 if (state->stage != MESA_SHADER_FRAGMENT) {
3950 _mesa_glsl_error(& (yylsp[0]), state,
3951 "inner_coverage layout qualifier only "
3952 "valid in fragment shaders");
3953 }
3954
3955 if (state->INTEL_conservative_rasterization_enable) {
3956 (yyval.type_qualifier).flags.q.inner_coverage = 1;
3957 } else {
3958 _mesa_glsl_error(& (yylsp[0]), state,
3959 "inner_coverage layout qualifier present, "
3960 "but the INTEL_conservative_rasterization extension "
3961 "is not enabled.");
3962 }
3963 }
3964
3965 if (match_layout_qualifier((yyvsp[0].identifier), "post_depth_coverage", state) == 0) {
3966 if (state->stage != MESA_SHADER_FRAGMENT) {
3967 _mesa_glsl_error(& (yylsp[0]), state,
3968 "post_depth_coverage layout qualifier only "
3969 "valid in fragment shaders");
3970 }
3971
3972 if (state->ARB_post_depth_coverage_enable ||
3973 state->INTEL_conservative_rasterization_enable) {
3974 (yyval.type_qualifier).flags.q.post_depth_coverage = 1;
3975 } else {
3976 _mesa_glsl_error(& (yylsp[0]), state,
3977 "post_depth_coverage layout qualifier present, "
3978 "but the GL_ARB_post_depth_coverage extension "
3979 "is not enabled.");
3980 }
3981 }
3982
3983 if ((yyval.type_qualifier).flags.q.post_depth_coverage && (yyval.type_qualifier).flags.q.inner_coverage) {
3984 _mesa_glsl_error(& (yylsp[0]), state,
3985 "post_depth_coverage & inner_coverage layout qualifiers "
3986 "are mutually exclusive");
3987 }
3988 }
3989
3990 const bool pixel_interlock_ordered = match_layout_qualifier((yyvsp[0].identifier),
3991 "pixel_interlock_ordered", state) == 0;
3992 const bool pixel_interlock_unordered = match_layout_qualifier((yyvsp[0].identifier),
3993 "pixel_interlock_unordered", state) == 0;
3994 const bool sample_interlock_ordered = match_layout_qualifier((yyvsp[0].identifier),
3995 "sample_interlock_ordered", state) == 0;
3996 const bool sample_interlock_unordered = match_layout_qualifier((yyvsp[0].identifier),
3997 "sample_interlock_unordered", state) == 0;
3998
3999 if (pixel_interlock_ordered + pixel_interlock_unordered +
4000 sample_interlock_ordered + sample_interlock_unordered > 0 &&
4001 state->stage != MESA_SHADER_FRAGMENT) {
4002 _mesa_glsl_error(& (yylsp[0]), state, "interlock layout qualifiers: "
4003 "pixel_interlock_ordered, pixel_interlock_unordered, "
4004 "sample_interlock_ordered and sample_interlock_unordered, "
4005 "only valid in fragment shader input layout declaration.");
4006 } else if (pixel_interlock_ordered + pixel_interlock_unordered +
4007 sample_interlock_ordered + sample_interlock_unordered > 0 &&
4008 !state->ARB_fragment_shader_interlock_enable &&
4009 !state->NV_fragment_shader_interlock_enable) {
4010 _mesa_glsl_error(& (yylsp[0]), state,
4011 "interlock layout qualifier present, but the "
4012 "GL_ARB_fragment_shader_interlock or "
4013 "GL_NV_fragment_shader_interlock extension is not "
4014 "enabled.");
4015 } else {
4016 (yyval.type_qualifier).flags.q.pixel_interlock_ordered = pixel_interlock_ordered;
4017 (yyval.type_qualifier).flags.q.pixel_interlock_unordered = pixel_interlock_unordered;
4018 (yyval.type_qualifier).flags.q.sample_interlock_ordered = sample_interlock_ordered;
4019 (yyval.type_qualifier).flags.q.sample_interlock_unordered = sample_interlock_unordered;
4020 }
4021
4022 /* Layout qualifiers for tessellation evaluation shaders. */
4023 if (!(yyval.type_qualifier).flags.i) {
4024 static const struct {
4025 const char *s;
4026 GLenum e;
4027 } map[] = {
4028 /* triangles already parsed by gs-specific code */
4029 { "quads", GL_QUADS },
4030 { "isolines", GL_ISOLINES },
4031 };
4032 for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
4033 if (match_layout_qualifier((yyvsp[0].identifier), map[i].s, state) == 0) {
4034 (yyval.type_qualifier).flags.q.prim_type = 1;
4035 (yyval.type_qualifier).prim_type = map[i].e;
4036 break;
4037 }
4038 }
4039
4040 if ((yyval.type_qualifier).flags.i && !state->has_tessellation_shader()) {
4041 _mesa_glsl_error(& (yylsp[0]), state,
4042 "primitive mode qualifier `%s' requires "
4043 "GLSL 4.00 or ARB_tessellation_shader", (yyvsp[0].identifier));
4044 }
4045 }
4046 if (!(yyval.type_qualifier).flags.i) {
4047 static const struct {
4048 const char *s;
4049 enum gl_tess_spacing e;
4050 } map[] = {
4051 { "equal_spacing", TESS_SPACING_EQUAL },
4052 { "fractional_odd_spacing", TESS_SPACING_FRACTIONAL_ODD },
4053 { "fractional_even_spacing", TESS_SPACING_FRACTIONAL_EVEN },
4054 };
4055 for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
4056 if (match_layout_qualifier((yyvsp[0].identifier), map[i].s, state) == 0) {
4057 (yyval.type_qualifier).flags.q.vertex_spacing = 1;
4058 (yyval.type_qualifier).vertex_spacing = map[i].e;
4059 break;
4060 }
4061 }
4062
4063 if ((yyval.type_qualifier).flags.i && !state->has_tessellation_shader()) {
4064 _mesa_glsl_error(& (yylsp[0]), state,
4065 "vertex spacing qualifier `%s' requires "
4066 "GLSL 4.00 or ARB_tessellation_shader", (yyvsp[0].identifier));
4067 }
4068 }
4069 if (!(yyval.type_qualifier).flags.i) {
4070 if (match_layout_qualifier((yyvsp[0].identifier), "cw", state) == 0) {
4071 (yyval.type_qualifier).flags.q.ordering = 1;
4072 (yyval.type_qualifier).ordering = GL_CW;
4073 } else if (match_layout_qualifier((yyvsp[0].identifier), "ccw", state) == 0) {
4074 (yyval.type_qualifier).flags.q.ordering = 1;
4075 (yyval.type_qualifier).ordering = GL_CCW;
4076 }
4077
4078 if ((yyval.type_qualifier).flags.i && !state->has_tessellation_shader()) {
4079 _mesa_glsl_error(& (yylsp[0]), state,
4080 "ordering qualifier `%s' requires "
4081 "GLSL 4.00 or ARB_tessellation_shader", (yyvsp[0].identifier));
4082 }
4083 }
4084 if (!(yyval.type_qualifier).flags.i) {
4085 if (match_layout_qualifier((yyvsp[0].identifier), "point_mode", state) == 0) {
4086 (yyval.type_qualifier).flags.q.point_mode = 1;
4087 (yyval.type_qualifier).point_mode = true;
4088 }
4089
4090 if ((yyval.type_qualifier).flags.i && !state->has_tessellation_shader()) {
4091 _mesa_glsl_error(& (yylsp[0]), state,
4092 "qualifier `point_mode' requires "
4093 "GLSL 4.00 or ARB_tessellation_shader");
4094 }
4095 }
4096
4097 if (!(yyval.type_qualifier).flags.i) {
4098 static const struct {
4099 const char *s;
4100 uint32_t mask;
4101 } map[] = {
4102 { "blend_support_multiply", BLEND_MULTIPLY },
4103 { "blend_support_screen", BLEND_SCREEN },
4104 { "blend_support_overlay", BLEND_OVERLAY },
4105 { "blend_support_darken", BLEND_DARKEN },
4106 { "blend_support_lighten", BLEND_LIGHTEN },
4107 { "blend_support_colordodge", BLEND_COLORDODGE },
4108 { "blend_support_colorburn", BLEND_COLORBURN },
4109 { "blend_support_hardlight", BLEND_HARDLIGHT },
4110 { "blend_support_softlight", BLEND_SOFTLIGHT },
4111 { "blend_support_difference", BLEND_DIFFERENCE },
4112 { "blend_support_exclusion", BLEND_EXCLUSION },
4113 { "blend_support_hsl_hue", BLEND_HSL_HUE },
4114 { "blend_support_hsl_saturation", BLEND_HSL_SATURATION },
4115 { "blend_support_hsl_color", BLEND_HSL_COLOR },
4116 { "blend_support_hsl_luminosity", BLEND_HSL_LUMINOSITY },
4117 { "blend_support_all_equations", BLEND_ALL },
4118 };
4119 for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
4120 if (match_layout_qualifier((yyvsp[0].identifier), map[i].s, state) == 0) {
4121 (yyval.type_qualifier).flags.q.blend_support = 1;
4122 state->fs_blend_support |= map[i].mask;
4123 break;
4124 }
4125 }
4126
4127 if ((yyval.type_qualifier).flags.i &&
4128 !state->KHR_blend_equation_advanced_enable &&
4129 !state->is_version(0, 320)) {
4130 _mesa_glsl_error(& (yylsp[0]), state,
4131 "advanced blending layout qualifiers require "
4132 "ESSL 3.20 or KHR_blend_equation_advanced");
4133 }
4134
4135 if ((yyval.type_qualifier).flags.i && state->stage != MESA_SHADER_FRAGMENT) {
4136 _mesa_glsl_error(& (yylsp[0]), state,
4137 "advanced blending layout qualifiers only "
4138 "valid in fragment shaders");
4139 }
4140 }
4141
4142 /* Layout qualifiers for ARB_compute_variable_group_size. */
4143 if (!(yyval.type_qualifier).flags.i) {
4144 if (match_layout_qualifier((yyvsp[0].identifier), "local_size_variable", state) == 0) {
4145 (yyval.type_qualifier).flags.q.local_size_variable = 1;
4146 }
4147
4148 if ((yyval.type_qualifier).flags.i && !state->ARB_compute_variable_group_size_enable) {
4149 _mesa_glsl_error(& (yylsp[0]), state,
4150 "qualifier `local_size_variable` requires "
4151 "ARB_compute_variable_group_size");
4152 }
4153 }
4154
4155 /* Layout qualifiers for ARB_bindless_texture. */
4156 if (!(yyval.type_qualifier).flags.i) {
4157 if (match_layout_qualifier((yyvsp[0].identifier), "bindless_sampler", state) == 0)
4158 (yyval.type_qualifier).flags.q.bindless_sampler = 1;
4159 if (match_layout_qualifier((yyvsp[0].identifier), "bound_sampler", state) == 0)
4160 (yyval.type_qualifier).flags.q.bound_sampler = 1;
4161
4162 if (state->has_shader_image_load_store()) {
4163 if (match_layout_qualifier((yyvsp[0].identifier), "bindless_image", state) == 0)
4164 (yyval.type_qualifier).flags.q.bindless_image = 1;
4165 if (match_layout_qualifier((yyvsp[0].identifier), "bound_image", state) == 0)
4166 (yyval.type_qualifier).flags.q.bound_image = 1;
4167 }
4168
4169 if ((yyval.type_qualifier).flags.i && !state->has_bindless()) {
4170 _mesa_glsl_error(& (yylsp[0]), state,
4171 "qualifier `%s` requires "
4172 "ARB_bindless_texture", (yyvsp[0].identifier));
4173 }
4174 }
4175
4176 if (!(yyval.type_qualifier).flags.i &&
4177 state->EXT_shader_framebuffer_fetch_non_coherent_enable) {
4178 if (match_layout_qualifier((yyvsp[0].identifier), "noncoherent", state) == 0)
4179 (yyval.type_qualifier).flags.q.non_coherent = 1;
4180 }
4181
4182 // Layout qualifiers for NV_compute_shader_derivatives.
4183 if (!(yyval.type_qualifier).flags.i) {
4184 if (match_layout_qualifier((yyvsp[0].identifier), "derivative_group_quadsNV", state) == 0) {
4185 (yyval.type_qualifier).flags.q.derivative_group = 1;
4186 (yyval.type_qualifier).derivative_group = DERIVATIVE_GROUP_QUADS;
4187 } else if (match_layout_qualifier((yyvsp[0].identifier), "derivative_group_linearNV", state) == 0) {
4188 (yyval.type_qualifier).flags.q.derivative_group = 1;
4189 (yyval.type_qualifier).derivative_group = DERIVATIVE_GROUP_LINEAR;
4190 }
4191
4192 if ((yyval.type_qualifier).flags.i) {
4193 if (!state->has_compute_shader()) {
4194 _mesa_glsl_error(& (yylsp[0]), state,
4195 "qualifier `%s' requires "
4196 "a compute shader", (yyvsp[0].identifier));
4197 }
4198
4199 if (!state->NV_compute_shader_derivatives_enable) {
4200 _mesa_glsl_error(& (yylsp[0]), state,
4201 "qualifier `%s' requires "
4202 "NV_compute_shader_derivatives", (yyvsp[0].identifier));
4203 }
4204
4205 if (state->NV_compute_shader_derivatives_warn) {
4206 _mesa_glsl_warning(& (yylsp[0]), state,
4207 "NV_compute_shader_derivatives layout "
4208 "qualifier `%s' used", (yyvsp[0].identifier));
4209 }
4210 }
4211 }
4212
4213 /* Layout qualifier for NV_viewport_array2. */
4214 if (!(yyval.type_qualifier).flags.i && state->stage != MESA_SHADER_FRAGMENT) {
4215 if (match_layout_qualifier((yyvsp[0].identifier), "viewport_relative", state) == 0) {
4216 (yyval.type_qualifier).flags.q.viewport_relative = 1;
4217 }
4218
4219 if ((yyval.type_qualifier).flags.i && !state->NV_viewport_array2_enable) {
4220 _mesa_glsl_error(& (yylsp[0]), state,
4221 "qualifier `%s' requires "
4222 "GL_NV_viewport_array2", (yyvsp[0].identifier));
4223 }
4224
4225 if ((yyval.type_qualifier).flags.i && state->NV_viewport_array2_warn) {
4226 _mesa_glsl_warning(& (yylsp[0]), state,
4227 "GL_NV_viewport_array2 layout "
4228 "identifier `%s' used", (yyvsp[0].identifier));
4229 }
4230 }
4231
4232 if (!(yyval.type_qualifier).flags.i) {
4233 _mesa_glsl_error(& (yylsp[0]), state, "unrecognized layout identifier "
4234 "`%s'", (yyvsp[0].identifier));
4235 YYERROR;
4236 }
4237 }
4238 #line 4239 "src/compiler/glsl/glsl_parser.cpp"
4239 break;
4240
4241 case 151:
4242 #line 1738 "src/compiler/glsl/glsl_parser.yy"
4243 {
4244 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4245 void *ctx = state->linalloc;
4246
4247 if ((yyvsp[0].expression)->oper != ast_int_constant &&
4248 (yyvsp[0].expression)->oper != ast_uint_constant &&
4249 !state->has_enhanced_layouts()) {
4250 _mesa_glsl_error(& (yylsp[-2]), state,
4251 "compile-time constant expressions require "
4252 "GLSL 4.40 or ARB_enhanced_layouts");
4253 }
4254
4255 if (match_layout_qualifier("align", (yyvsp[-2].identifier), state) == 0) {
4256 if (!state->has_enhanced_layouts()) {
4257 _mesa_glsl_error(& (yylsp[-2]), state,
4258 "align qualifier requires "
4259 "GLSL 4.40 or ARB_enhanced_layouts");
4260 } else {
4261 (yyval.type_qualifier).flags.q.explicit_align = 1;
4262 (yyval.type_qualifier).align = (yyvsp[0].expression);
4263 }
4264 }
4265
4266 if (match_layout_qualifier("location", (yyvsp[-2].identifier), state) == 0) {
4267 (yyval.type_qualifier).flags.q.explicit_location = 1;
4268
4269 if ((yyval.type_qualifier).flags.q.attribute == 1 &&
4270 state->ARB_explicit_attrib_location_warn) {
4271 _mesa_glsl_warning(& (yylsp[-2]), state,
4272 "GL_ARB_explicit_attrib_location layout "
4273 "identifier `%s' used", (yyvsp[-2].identifier));
4274 }
4275 (yyval.type_qualifier).location = (yyvsp[0].expression);
4276 }
4277
4278 if (match_layout_qualifier("component", (yyvsp[-2].identifier), state) == 0) {
4279 if (!state->has_enhanced_layouts()) {
4280 _mesa_glsl_error(& (yylsp[-2]), state,
4281 "component qualifier requires "
4282 "GLSL 4.40 or ARB_enhanced_layouts");
4283 } else {
4284 (yyval.type_qualifier).flags.q.explicit_component = 1;
4285 (yyval.type_qualifier).component = (yyvsp[0].expression);
4286 }
4287 }
4288
4289 if (match_layout_qualifier("index", (yyvsp[-2].identifier), state) == 0) {
4290 if (state->es_shader && !state->EXT_blend_func_extended_enable) {
4291 _mesa_glsl_error(& (yylsp[0]), state, "index layout qualifier requires EXT_blend_func_extended");
4292 YYERROR;
4293 }
4294
4295 (yyval.type_qualifier).flags.q.explicit_index = 1;
4296 (yyval.type_qualifier).index = (yyvsp[0].expression);
4297 }
4298
4299 if ((state->has_420pack_or_es31() ||
4300 state->has_atomic_counters() ||
4301 state->has_shader_storage_buffer_objects()) &&
4302 match_layout_qualifier("binding", (yyvsp[-2].identifier), state) == 0) {
4303 (yyval.type_qualifier).flags.q.explicit_binding = 1;
4304 (yyval.type_qualifier).binding = (yyvsp[0].expression);
4305 }
4306
4307 if ((state->has_atomic_counters() ||
4308 state->has_enhanced_layouts()) &&
4309 match_layout_qualifier("offset", (yyvsp[-2].identifier), state) == 0) {
4310 (yyval.type_qualifier).flags.q.explicit_offset = 1;
4311 (yyval.type_qualifier).offset = (yyvsp[0].expression);
4312 }
4313
4314 if (match_layout_qualifier("max_vertices", (yyvsp[-2].identifier), state) == 0) {
4315 (yyval.type_qualifier).flags.q.max_vertices = 1;
4316 (yyval.type_qualifier).max_vertices = new(ctx) ast_layout_expression((yylsp[-2]), (yyvsp[0].expression));
4317 if (!state->has_geometry_shader()) {
4318 _mesa_glsl_error(& (yylsp[0]), state,
4319 "#version 150 max_vertices qualifier "
4320 "specified", (yyvsp[0].expression));
4321 }
4322 }
4323
4324 if (state->stage == MESA_SHADER_GEOMETRY) {
4325 if (match_layout_qualifier("stream", (yyvsp[-2].identifier), state) == 0 &&
4326 state->check_explicit_attrib_stream_allowed(& (yylsp[0]))) {
4327 (yyval.type_qualifier).flags.q.stream = 1;
4328 (yyval.type_qualifier).flags.q.explicit_stream = 1;
4329 (yyval.type_qualifier).stream = (yyvsp[0].expression);
4330 }
4331 }
4332
4333 if (state->has_enhanced_layouts()) {
4334 if (match_layout_qualifier("xfb_buffer", (yyvsp[-2].identifier), state) == 0) {
4335 (yyval.type_qualifier).flags.q.xfb_buffer = 1;
4336 (yyval.type_qualifier).flags.q.explicit_xfb_buffer = 1;
4337 (yyval.type_qualifier).xfb_buffer = (yyvsp[0].expression);
4338 }
4339
4340 if (match_layout_qualifier("xfb_offset", (yyvsp[-2].identifier), state) == 0) {
4341 (yyval.type_qualifier).flags.q.explicit_xfb_offset = 1;
4342 (yyval.type_qualifier).offset = (yyvsp[0].expression);
4343 }
4344
4345 if (match_layout_qualifier("xfb_stride", (yyvsp[-2].identifier), state) == 0) {
4346 (yyval.type_qualifier).flags.q.xfb_stride = 1;
4347 (yyval.type_qualifier).flags.q.explicit_xfb_stride = 1;
4348 (yyval.type_qualifier).xfb_stride = (yyvsp[0].expression);
4349 }
4350 }
4351
4352 static const char * const local_size_qualifiers[3] = {
4353 "local_size_x",
4354 "local_size_y",
4355 "local_size_z",
4356 };
4357 for (int i = 0; i < 3; i++) {
4358 if (match_layout_qualifier(local_size_qualifiers[i], (yyvsp[-2].identifier),
4359 state) == 0) {
4360 if (!state->has_compute_shader()) {
4361 _mesa_glsl_error(& (yylsp[0]), state,
4362 "%s qualifier requires GLSL 4.30 or "
4363 "GLSL ES 3.10 or ARB_compute_shader",
4364 local_size_qualifiers[i]);
4365 YYERROR;
4366 } else {
4367 (yyval.type_qualifier).flags.q.local_size |= (1 << i);
4368 (yyval.type_qualifier).local_size[i] = new(ctx) ast_layout_expression((yylsp[-2]), (yyvsp[0].expression));
4369 }
4370 break;
4371 }
4372 }
4373
4374 if (match_layout_qualifier("invocations", (yyvsp[-2].identifier), state) == 0) {
4375 (yyval.type_qualifier).flags.q.invocations = 1;
4376 (yyval.type_qualifier).invocations = new(ctx) ast_layout_expression((yylsp[-2]), (yyvsp[0].expression));
4377 if (!state->is_version(400, 320) &&
4378 !state->ARB_gpu_shader5_enable &&
4379 !state->OES_geometry_shader_enable &&
4380 !state->EXT_geometry_shader_enable) {
4381 _mesa_glsl_error(& (yylsp[0]), state,
4382 "GL_ARB_gpu_shader5 invocations "
4383 "qualifier specified", (yyvsp[0].expression));
4384 }
4385 }
4386
4387 /* Layout qualifiers for tessellation control shaders. */
4388 if (match_layout_qualifier("vertices", (yyvsp[-2].identifier), state) == 0) {
4389 (yyval.type_qualifier).flags.q.vertices = 1;
4390 (yyval.type_qualifier).vertices = new(ctx) ast_layout_expression((yylsp[-2]), (yyvsp[0].expression));
4391 if (!state->has_tessellation_shader()) {
4392 _mesa_glsl_error(& (yylsp[-2]), state,
4393 "vertices qualifier requires GLSL 4.00 or "
4394 "ARB_tessellation_shader");
4395 }
4396 }
4397
4398 /* If the identifier didn't match any known layout identifiers,
4399 * emit an error.
4400 */
4401 if (!(yyval.type_qualifier).flags.i) {
4402 _mesa_glsl_error(& (yylsp[-2]), state, "unrecognized layout identifier "
4403 "`%s'", (yyvsp[-2].identifier));
4404 YYERROR;
4405 }
4406 }
4407 #line 4408 "src/compiler/glsl/glsl_parser.cpp"
4408 break;
4409
4410 case 152:
4411 #line 1903 "src/compiler/glsl/glsl_parser.yy"
4412 {
4413 (yyval.type_qualifier) = (yyvsp[0].type_qualifier);
4414 /* Layout qualifiers for ARB_uniform_buffer_object. */
4415 if ((yyval.type_qualifier).flags.q.uniform && !state->has_uniform_buffer_objects()) {
4416 _mesa_glsl_error(& (yylsp[0]), state,
4417 "#version 140 / GL_ARB_uniform_buffer_object "
4418 "layout qualifier `%s' is used", (yyvsp[0].type_qualifier));
4419 } else if ((yyval.type_qualifier).flags.q.uniform && state->ARB_uniform_buffer_object_warn) {
4420 _mesa_glsl_warning(& (yylsp[0]), state,
4421 "#version 140 / GL_ARB_uniform_buffer_object "
4422 "layout qualifier `%s' is used", (yyvsp[0].type_qualifier));
4423 }
4424 }
4425 #line 4426 "src/compiler/glsl/glsl_parser.cpp"
4426 break;
4427
4428 case 153:
4429 #line 1929 "src/compiler/glsl/glsl_parser.yy"
4430 {
4431 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4432 (yyval.type_qualifier).flags.q.row_major = 1;
4433 }
4434 #line 4435 "src/compiler/glsl/glsl_parser.cpp"
4435 break;
4436
4437 case 154:
4438 #line 1934 "src/compiler/glsl/glsl_parser.yy"
4439 {
4440 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4441 (yyval.type_qualifier).flags.q.packed = 1;
4442 }
4443 #line 4444 "src/compiler/glsl/glsl_parser.cpp"
4444 break;
4445
4446 case 155:
4447 #line 1939 "src/compiler/glsl/glsl_parser.yy"
4448 {
4449 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4450 (yyval.type_qualifier).flags.q.shared = 1;
4451 }
4452 #line 4453 "src/compiler/glsl/glsl_parser.cpp"
4453 break;
4454
4455 case 156:
4456 #line 1947 "src/compiler/glsl/glsl_parser.yy"
4457 {
4458 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4459 (yyval.type_qualifier).flags.q.subroutine = 1;
4460 }
4461 #line 4462 "src/compiler/glsl/glsl_parser.cpp"
4462 break;
4463
4464 case 157:
4465 #line 1952 "src/compiler/glsl/glsl_parser.yy"
4466 {
4467 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4468 (yyval.type_qualifier).flags.q.subroutine = 1;
4469 (yyval.type_qualifier).subroutine_list = (yyvsp[-1].subroutine_list);
4470 }
4471 #line 4472 "src/compiler/glsl/glsl_parser.cpp"
4472 break;
4473
4474 case 158:
4475 #line 1961 "src/compiler/glsl/glsl_parser.yy"
4476 {
4477 void *ctx = state->linalloc;
4478 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[0].identifier), NULL, NULL);
4479 decl->set_location((yylsp[0]));
4480
4481 (yyval.subroutine_list) = new(ctx) ast_subroutine_list();
4482 (yyval.subroutine_list)->declarations.push_tail(&decl->link);
4483 }
4484 #line 4485 "src/compiler/glsl/glsl_parser.cpp"
4485 break;
4486
4487 case 159:
4488 #line 1970 "src/compiler/glsl/glsl_parser.yy"
4489 {
4490 void *ctx = state->linalloc;
4491 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[0].identifier), NULL, NULL);
4492 decl->set_location((yylsp[0]));
4493
4494 (yyval.subroutine_list) = (yyvsp[-2].subroutine_list);
4495 (yyval.subroutine_list)->declarations.push_tail(&decl->link);
4496 }
4497 #line 4498 "src/compiler/glsl/glsl_parser.cpp"
4498 break;
4499
4500 case 160:
4501 #line 1982 "src/compiler/glsl/glsl_parser.yy"
4502 {
4503 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4504 (yyval.type_qualifier).flags.q.smooth = 1;
4505 }
4506 #line 4507 "src/compiler/glsl/glsl_parser.cpp"
4507 break;
4508
4509 case 161:
4510 #line 1987 "src/compiler/glsl/glsl_parser.yy"
4511 {
4512 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4513 (yyval.type_qualifier).flags.q.flat = 1;
4514 }
4515 #line 4516 "src/compiler/glsl/glsl_parser.cpp"
4516 break;
4517
4518 case 162:
4519 #line 1992 "src/compiler/glsl/glsl_parser.yy"
4520 {
4521 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4522 (yyval.type_qualifier).flags.q.noperspective = 1;
4523 }
4524 #line 4525 "src/compiler/glsl/glsl_parser.cpp"
4525 break;
4526
4527 case 163:
4528 #line 2001 "src/compiler/glsl/glsl_parser.yy"
4529 {
4530 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4531 (yyval.type_qualifier).flags.q.invariant = 1;
4532 }
4533 #line 4534 "src/compiler/glsl/glsl_parser.cpp"
4534 break;
4535
4536 case 164:
4537 #line 2006 "src/compiler/glsl/glsl_parser.yy"
4538 {
4539 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4540 (yyval.type_qualifier).flags.q.precise = 1;
4541 }
4542 #line 4543 "src/compiler/glsl/glsl_parser.cpp"
4543 break;
4544
4545 case 171:
4546 #line 2017 "src/compiler/glsl/glsl_parser.yy"
4547 {
4548 memset(&(yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4549 (yyval.type_qualifier).precision = (yyvsp[0].n);
4550 }
4551 #line 4552 "src/compiler/glsl/glsl_parser.cpp"
4552 break;
4553
4554 case 172:
4555 #line 2035 "src/compiler/glsl/glsl_parser.yy"
4556 {
4557 if ((yyvsp[0].type_qualifier).flags.q.precise)
4558 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate \"precise\" qualifier");
4559
4560 (yyval.type_qualifier) = (yyvsp[0].type_qualifier);
4561 (yyval.type_qualifier).flags.q.precise = 1;
4562 }
4563 #line 4564 "src/compiler/glsl/glsl_parser.cpp"
4564 break;
4565
4566 case 173:
4567 #line 2043 "src/compiler/glsl/glsl_parser.yy"
4568 {
4569 if ((yyvsp[0].type_qualifier).flags.q.invariant)
4570 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate \"invariant\" qualifier");
4571
4572 if (!state->has_420pack_or_es31() && (yyvsp[0].type_qualifier).flags.q.precise)
4573 _mesa_glsl_error(&(yylsp[-1]), state,
4574 "\"invariant\" must come after \"precise\"");
4575
4576 (yyval.type_qualifier) = (yyvsp[0].type_qualifier);
4577 (yyval.type_qualifier).flags.q.invariant = 1;
4578
4579 /* GLSL ES 3.00 spec, section 4.6.1 "The Invariant Qualifier":
4580 *
4581 * "Only variables output from a shader can be candidates for invariance.
4582 * This includes user-defined output variables and the built-in output
4583 * variables. As only outputs can be declared as invariant, an invariant
4584 * output from one shader stage will still match an input of a subsequent
4585 * stage without the input being declared as invariant."
4586 *
4587 * On the desktop side, this text first appears in GLSL 4.30.
4588 */
4589 if (state->is_version(430, 300) && (yyval.type_qualifier).flags.q.in)
4590 _mesa_glsl_error(&(yylsp[-1]), state, "invariant qualifiers cannot be used with shader inputs");
4591 }
4592 #line 4593 "src/compiler/glsl/glsl_parser.cpp"
4593 break;
4594
4595 case 174:
4596 #line 2068 "src/compiler/glsl/glsl_parser.yy"
4597 {
4598 /* Section 4.3 of the GLSL 1.40 specification states:
4599 * "...qualified with one of these interpolation qualifiers"
4600 *
4601 * GLSL 1.30 claims to allow "one or more", but insists that:
4602 * "These interpolation qualifiers may only precede the qualifiers in,
4603 * centroid in, out, or centroid out in a declaration."
4604 *
4605 * ...which means that e.g. smooth can't precede smooth, so there can be
4606 * only one after all, and the 1.40 text is a clarification, not a change.
4607 */
4608 if ((yyvsp[0].type_qualifier).has_interpolation())
4609 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate interpolation qualifier");
4610
4611 if (!state->has_420pack_or_es31() &&
4612 ((yyvsp[0].type_qualifier).flags.q.precise || (yyvsp[0].type_qualifier).flags.q.invariant)) {
4613 _mesa_glsl_error(&(yylsp[-1]), state, "interpolation qualifiers must come "
4614 "after \"precise\" or \"invariant\"");
4615 }
4616
4617 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
4618 (yyval.type_qualifier).merge_qualifier(&(yylsp[-1]), state, (yyvsp[0].type_qualifier), false);
4619 }
4620 #line 4621 "src/compiler/glsl/glsl_parser.cpp"
4621 break;
4622
4623 case 175:
4624 #line 2092 "src/compiler/glsl/glsl_parser.yy"
4625 {
4626 /* In the absence of ARB_shading_language_420pack, layout qualifiers may
4627 * appear no later than auxiliary storage qualifiers. There is no
4628 * particularly clear spec language mandating this, but in all examples
4629 * the layout qualifier precedes the storage qualifier.
4630 *
4631 * We allow combinations of layout with interpolation, invariant or
4632 * precise qualifiers since these are useful in ARB_separate_shader_objects.
4633 * There is no clear spec guidance on this either.
4634 */
4635 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
4636 (yyval.type_qualifier).merge_qualifier(& (yylsp[-1]), state, (yyvsp[0].type_qualifier), false, (yyvsp[0].type_qualifier).has_layout());
4637 }
4638 #line 4639 "src/compiler/glsl/glsl_parser.cpp"
4639 break;
4640
4641 case 176:
4642 #line 2106 "src/compiler/glsl/glsl_parser.yy"
4643 {
4644 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
4645 (yyval.type_qualifier).merge_qualifier(&(yylsp[-1]), state, (yyvsp[0].type_qualifier), false);
4646 }
4647 #line 4648 "src/compiler/glsl/glsl_parser.cpp"
4648 break;
4649
4650 case 177:
4651 #line 2111 "src/compiler/glsl/glsl_parser.yy"
4652 {
4653 if ((yyvsp[0].type_qualifier).has_auxiliary_storage()) {
4654 _mesa_glsl_error(&(yylsp[-1]), state,
4655 "duplicate auxiliary storage qualifier (centroid or sample)");
4656 }
4657
4658 if ((!state->has_420pack_or_es31() && !state->EXT_gpu_shader4_enable) &&
4659 ((yyvsp[0].type_qualifier).flags.q.precise || (yyvsp[0].type_qualifier).flags.q.invariant ||
4660 (yyvsp[0].type_qualifier).has_interpolation() || (yyvsp[0].type_qualifier).has_layout())) {
4661 _mesa_glsl_error(&(yylsp[-1]), state, "auxiliary storage qualifiers must come "
4662 "just before storage qualifiers");
4663 }
4664 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
4665 (yyval.type_qualifier).merge_qualifier(&(yylsp[-1]), state, (yyvsp[0].type_qualifier), false);
4666 }
4667 #line 4668 "src/compiler/glsl/glsl_parser.cpp"
4668 break;
4669
4670 case 178:
4671 #line 2127 "src/compiler/glsl/glsl_parser.yy"
4672 {
4673 /* Section 4.3 of the GLSL 1.20 specification states:
4674 * "Variable declarations may have a storage qualifier specified..."
4675 * 1.30 clarifies this to "may have one storage qualifier".
4676 *
4677 * GL_EXT_gpu_shader4 allows "varying out" in fragment shaders.
4678 */
4679 if ((yyvsp[0].type_qualifier).has_storage() &&
4680 (!state->EXT_gpu_shader4_enable ||
4681 state->stage != MESA_SHADER_FRAGMENT ||
4682 !(yyvsp[-1].type_qualifier).flags.q.varying || !(yyvsp[0].type_qualifier).flags.q.out))
4683 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate storage qualifier");
4684
4685 if (!state->has_420pack_or_es31() &&
4686 ((yyvsp[0].type_qualifier).flags.q.precise || (yyvsp[0].type_qualifier).flags.q.invariant || (yyvsp[0].type_qualifier).has_interpolation() ||
4687 (yyvsp[0].type_qualifier).has_layout() || (yyvsp[0].type_qualifier).has_auxiliary_storage())) {
4688 _mesa_glsl_error(&(yylsp[-1]), state, "storage qualifiers must come after "
4689 "precise, invariant, interpolation, layout and auxiliary "
4690 "storage qualifiers");
4691 }
4692
4693 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
4694 (yyval.type_qualifier).merge_qualifier(&(yylsp[-1]), state, (yyvsp[0].type_qualifier), false);
4695 }
4696 #line 4697 "src/compiler/glsl/glsl_parser.cpp"
4697 break;
4698
4699 case 179:
4700 #line 2152 "src/compiler/glsl/glsl_parser.yy"
4701 {
4702 if ((yyvsp[0].type_qualifier).precision != ast_precision_none)
4703 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate precision qualifier");
4704
4705 if (!(state->has_420pack_or_es31()) &&
4706 (yyvsp[0].type_qualifier).flags.i != 0)
4707 _mesa_glsl_error(&(yylsp[-1]), state, "precision qualifiers must come last");
4708
4709 (yyval.type_qualifier) = (yyvsp[0].type_qualifier);
4710 (yyval.type_qualifier).precision = (yyvsp[-1].n);
4711 }
4712 #line 4713 "src/compiler/glsl/glsl_parser.cpp"
4713 break;
4714
4715 case 180:
4716 #line 2164 "src/compiler/glsl/glsl_parser.yy"
4717 {
4718 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
4719 (yyval.type_qualifier).merge_qualifier(&(yylsp[-1]), state, (yyvsp[0].type_qualifier), false);
4720 }
4721 #line 4722 "src/compiler/glsl/glsl_parser.cpp"
4722 break;
4723
4724 case 181:
4725 #line 2172 "src/compiler/glsl/glsl_parser.yy"
4726 {
4727 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4728 (yyval.type_qualifier).flags.q.centroid = 1;
4729 }
4730 #line 4731 "src/compiler/glsl/glsl_parser.cpp"
4731 break;
4732
4733 case 182:
4734 #line 2177 "src/compiler/glsl/glsl_parser.yy"
4735 {
4736 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4737 (yyval.type_qualifier).flags.q.sample = 1;
4738 }
4739 #line 4740 "src/compiler/glsl/glsl_parser.cpp"
4740 break;
4741
4742 case 183:
4743 #line 2182 "src/compiler/glsl/glsl_parser.yy"
4744 {
4745 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4746 (yyval.type_qualifier).flags.q.patch = 1;
4747 }
4748 #line 4749 "src/compiler/glsl/glsl_parser.cpp"
4749 break;
4750
4751 case 184:
4752 #line 2189 "src/compiler/glsl/glsl_parser.yy"
4753 {
4754 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4755 (yyval.type_qualifier).flags.q.constant = 1;
4756 }
4757 #line 4758 "src/compiler/glsl/glsl_parser.cpp"
4758 break;
4759
4760 case 185:
4761 #line 2194 "src/compiler/glsl/glsl_parser.yy"
4762 {
4763 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4764 (yyval.type_qualifier).flags.q.attribute = 1;
4765 }
4766 #line 4767 "src/compiler/glsl/glsl_parser.cpp"
4767 break;
4768
4769 case 186:
4770 #line 2199 "src/compiler/glsl/glsl_parser.yy"
4771 {
4772 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4773 (yyval.type_qualifier).flags.q.varying = 1;
4774 }
4775 #line 4776 "src/compiler/glsl/glsl_parser.cpp"
4776 break;
4777
4778 case 187:
4779 #line 2204 "src/compiler/glsl/glsl_parser.yy"
4780 {
4781 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4782 (yyval.type_qualifier).flags.q.in = 1;
4783 }
4784 #line 4785 "src/compiler/glsl/glsl_parser.cpp"
4785 break;
4786
4787 case 188:
4788 #line 2209 "src/compiler/glsl/glsl_parser.yy"
4789 {
4790 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4791 (yyval.type_qualifier).flags.q.out = 1;
4792
4793 if (state->stage == MESA_SHADER_GEOMETRY &&
4794 state->has_explicit_attrib_stream()) {
4795 /* Section 4.3.8.2 (Output Layout Qualifiers) of the GLSL 4.00
4796 * spec says:
4797 *
4798 * "If the block or variable is declared with the stream
4799 * identifier, it is associated with the specified stream;
4800 * otherwise, it is associated with the current default stream."
4801 */
4802 (yyval.type_qualifier).flags.q.stream = 1;
4803 (yyval.type_qualifier).flags.q.explicit_stream = 0;
4804 (yyval.type_qualifier).stream = state->out_qualifier->stream;
4805 }
4806
4807 if (state->has_enhanced_layouts()) {
4808 (yyval.type_qualifier).flags.q.xfb_buffer = 1;
4809 (yyval.type_qualifier).flags.q.explicit_xfb_buffer = 0;
4810 (yyval.type_qualifier).xfb_buffer = state->out_qualifier->xfb_buffer;
4811 }
4812 }
4813 #line 4814 "src/compiler/glsl/glsl_parser.cpp"
4814 break;
4815
4816 case 189:
4817 #line 2234 "src/compiler/glsl/glsl_parser.yy"
4818 {
4819 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4820 (yyval.type_qualifier).flags.q.in = 1;
4821 (yyval.type_qualifier).flags.q.out = 1;
4822
4823 if (!state->has_framebuffer_fetch() ||
4824 !state->is_version(130, 300) ||
4825 state->stage != MESA_SHADER_FRAGMENT)
4826 _mesa_glsl_error(&(yylsp[0]), state, "A single interface variable cannot be "
4827 "declared as both input and output");
4828 }
4829 #line 4830 "src/compiler/glsl/glsl_parser.cpp"
4830 break;
4831
4832 case 190:
4833 #line 2246 "src/compiler/glsl/glsl_parser.yy"
4834 {
4835 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4836 (yyval.type_qualifier).flags.q.uniform = 1;
4837 }
4838 #line 4839 "src/compiler/glsl/glsl_parser.cpp"
4839 break;
4840
4841 case 191:
4842 #line 2251 "src/compiler/glsl/glsl_parser.yy"
4843 {
4844 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4845 (yyval.type_qualifier).flags.q.buffer = 1;
4846 }
4847 #line 4848 "src/compiler/glsl/glsl_parser.cpp"
4848 break;
4849
4850 case 192:
4851 #line 2256 "src/compiler/glsl/glsl_parser.yy"
4852 {
4853 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4854 (yyval.type_qualifier).flags.q.shared_storage = 1;
4855 }
4856 #line 4857 "src/compiler/glsl/glsl_parser.cpp"
4857 break;
4858
4859 case 193:
4860 #line 2264 "src/compiler/glsl/glsl_parser.yy"
4861 {
4862 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4863 (yyval.type_qualifier).flags.q.coherent = 1;
4864 }
4865 #line 4866 "src/compiler/glsl/glsl_parser.cpp"
4866 break;
4867
4868 case 194:
4869 #line 2269 "src/compiler/glsl/glsl_parser.yy"
4870 {
4871 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4872 (yyval.type_qualifier).flags.q._volatile = 1;
4873 }
4874 #line 4875 "src/compiler/glsl/glsl_parser.cpp"
4875 break;
4876
4877 case 195:
4878 #line 2274 "src/compiler/glsl/glsl_parser.yy"
4879 {
4880 STATIC_ASSERT(sizeof((yyval.type_qualifier).flags.q) <= sizeof((yyval.type_qualifier).flags.i));
4881 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4882 (yyval.type_qualifier).flags.q.restrict_flag = 1;
4883 }
4884 #line 4885 "src/compiler/glsl/glsl_parser.cpp"
4885 break;
4886
4887 case 196:
4888 #line 2280 "src/compiler/glsl/glsl_parser.yy"
4889 {
4890 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4891 (yyval.type_qualifier).flags.q.read_only = 1;
4892 }
4893 #line 4894 "src/compiler/glsl/glsl_parser.cpp"
4894 break;
4895
4896 case 197:
4897 #line 2285 "src/compiler/glsl/glsl_parser.yy"
4898 {
4899 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
4900 (yyval.type_qualifier).flags.q.write_only = 1;
4901 }
4902 #line 4903 "src/compiler/glsl/glsl_parser.cpp"
4903 break;
4904
4905 case 198:
4906 #line 2293 "src/compiler/glsl/glsl_parser.yy"
4907 {
4908 void *ctx = state->linalloc;
4909 (yyval.array_specifier) = new(ctx) ast_array_specifier((yylsp[-1]), new(ctx) ast_expression(
4910 ast_unsized_array_dim, NULL,
4911 NULL, NULL));
4912 (yyval.array_specifier)->set_location_range((yylsp[-1]), (yylsp[0]));
4913 }
4914 #line 4915 "src/compiler/glsl/glsl_parser.cpp"
4915 break;
4916
4917 case 199:
4918 #line 2301 "src/compiler/glsl/glsl_parser.yy"
4919 {
4920 void *ctx = state->linalloc;
4921 (yyval.array_specifier) = new(ctx) ast_array_specifier((yylsp[-2]), (yyvsp[-1].expression));
4922 (yyval.array_specifier)->set_location_range((yylsp[-2]), (yylsp[0]));
4923 }
4924 #line 4925 "src/compiler/glsl/glsl_parser.cpp"
4925 break;
4926
4927 case 200:
4928 #line 2307 "src/compiler/glsl/glsl_parser.yy"
4929 {
4930 void *ctx = state->linalloc;
4931 (yyval.array_specifier) = (yyvsp[-2].array_specifier);
4932
4933 if (state->check_arrays_of_arrays_allowed(& (yylsp[-2]))) {
4934 (yyval.array_specifier)->add_dimension(new(ctx) ast_expression(ast_unsized_array_dim, NULL,
4935 NULL, NULL));
4936 }
4937 }
4938 #line 4939 "src/compiler/glsl/glsl_parser.cpp"
4939 break;
4940
4941 case 201:
4942 #line 2317 "src/compiler/glsl/glsl_parser.yy"
4943 {
4944 (yyval.array_specifier) = (yyvsp[-3].array_specifier);
4945
4946 if (state->check_arrays_of_arrays_allowed(& (yylsp[-3]))) {
4947 (yyval.array_specifier)->add_dimension((yyvsp[-1].expression));
4948 }
4949 }
4950 #line 4951 "src/compiler/glsl/glsl_parser.cpp"
4951 break;
4952
4953 case 203:
4954 #line 2329 "src/compiler/glsl/glsl_parser.yy"
4955 {
4956 (yyval.type_specifier) = (yyvsp[-1].type_specifier);
4957 (yyval.type_specifier)->array_specifier = (yyvsp[0].array_specifier);
4958 }
4959 #line 4960 "src/compiler/glsl/glsl_parser.cpp"
4960 break;
4961
4962 case 204:
4963 #line 2337 "src/compiler/glsl/glsl_parser.yy"
4964 {
4965 void *ctx = state->linalloc;
4966 (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[0].type));
4967 (yyval.type_specifier)->set_location((yylsp[0]));
4968 }
4969 #line 4970 "src/compiler/glsl/glsl_parser.cpp"
4970 break;
4971
4972 case 205:
4973 #line 2343 "src/compiler/glsl/glsl_parser.yy"
4974 {
4975 void *ctx = state->linalloc;
4976 (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[0].struct_specifier));
4977 (yyval.type_specifier)->set_location((yylsp[0]));
4978 }
4979 #line 4980 "src/compiler/glsl/glsl_parser.cpp"
4980 break;
4981
4982 case 206:
4983 #line 2349 "src/compiler/glsl/glsl_parser.yy"
4984 {
4985 void *ctx = state->linalloc;
4986 (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[0].identifier));
4987 (yyval.type_specifier)->set_location((yylsp[0]));
4988 }
4989 #line 4990 "src/compiler/glsl/glsl_parser.cpp"
4990 break;
4991
4992 case 207:
4993 #line 2357 "src/compiler/glsl/glsl_parser.yy"
4994 { (yyval.type) = glsl_type::void_type; }
4995 #line 4996 "src/compiler/glsl/glsl_parser.cpp"
4996 break;
4997
4998 case 208:
4999 #line 2358 "src/compiler/glsl/glsl_parser.yy"
5000 { (yyval.type) = (yyvsp[0].type); }
5001 #line 5002 "src/compiler/glsl/glsl_parser.cpp"
5002 break;
5003
5004 case 209:
5005 #line 2360 "src/compiler/glsl/glsl_parser.yy"
5006 {
5007 if ((yyvsp[0].type) == glsl_type::int_type) {
5008 (yyval.type) = glsl_type::uint_type;
5009 } else {
5010 _mesa_glsl_error(&(yylsp[-1]), state,
5011 "\"unsigned\" is only allowed before \"int\"");
5012 }
5013 }
5014 #line 5015 "src/compiler/glsl/glsl_parser.cpp"
5015 break;
5016
5017 case 210:
5018 #line 2372 "src/compiler/glsl/glsl_parser.yy"
5019 {
5020 state->check_precision_qualifiers_allowed(&(yylsp[0]));
5021 (yyval.n) = ast_precision_high;
5022 }
5023 #line 5024 "src/compiler/glsl/glsl_parser.cpp"
5024 break;
5025
5026 case 211:
5027 #line 2377 "src/compiler/glsl/glsl_parser.yy"
5028 {
5029 state->check_precision_qualifiers_allowed(&(yylsp[0]));
5030 (yyval.n) = ast_precision_medium;
5031 }
5032 #line 5033 "src/compiler/glsl/glsl_parser.cpp"
5033 break;
5034
5035 case 212:
5036 #line 2382 "src/compiler/glsl/glsl_parser.yy"
5037 {
5038 state->check_precision_qualifiers_allowed(&(yylsp[0]));
5039 (yyval.n) = ast_precision_low;
5040 }
5041 #line 5042 "src/compiler/glsl/glsl_parser.cpp"
5042 break;
5043
5044 case 213:
5045 #line 2390 "src/compiler/glsl/glsl_parser.yy"
5046 {
5047 void *ctx = state->linalloc;
5048 (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[-3].identifier), (yyvsp[-1].declarator_list));
5049 (yyval.struct_specifier)->set_location_range((yylsp[-3]), (yylsp[0]));
5050 state->symbols->add_type((yyvsp[-3].identifier), glsl_type::void_type);
5051 }
5052 #line 5053 "src/compiler/glsl/glsl_parser.cpp"
5053 break;
5054
5055 case 214:
5056 #line 2397 "src/compiler/glsl/glsl_parser.yy"
5057 {
5058 void *ctx = state->linalloc;
5059
5060 /* All anonymous structs have the same name. This simplifies matching of
5061 * globals whose type is an unnamed struct.
5062 *
5063 * It also avoids a memory leak when the same shader is compiled over and
5064 * over again.
5065 */
5066 (yyval.struct_specifier) = new(ctx) ast_struct_specifier("#anon_struct", (yyvsp[-1].declarator_list));
5067
5068 (yyval.struct_specifier)->set_location_range((yylsp[-2]), (yylsp[0]));
5069 }
5070 #line 5071 "src/compiler/glsl/glsl_parser.cpp"
5071 break;
5072
5073 case 215:
5074 #line 2414 "src/compiler/glsl/glsl_parser.yy"
5075 {
5076 (yyval.declarator_list) = (yyvsp[0].declarator_list);
5077 (yyvsp[0].declarator_list)->link.self_link();
5078 }
5079 #line 5080 "src/compiler/glsl/glsl_parser.cpp"
5080 break;
5081
5082 case 216:
5083 #line 2419 "src/compiler/glsl/glsl_parser.yy"
5084 {
5085 (yyval.declarator_list) = (yyvsp[-1].declarator_list);
5086 (yyval.declarator_list)->link.insert_before(& (yyvsp[0].declarator_list)->link);
5087 }
5088 #line 5089 "src/compiler/glsl/glsl_parser.cpp"
5089 break;
5090
5091 case 217:
5092 #line 2427 "src/compiler/glsl/glsl_parser.yy"
5093 {
5094 void *ctx = state->linalloc;
5095 ast_fully_specified_type *const type = (yyvsp[-2].fully_specified_type);
5096 type->set_location((yylsp[-2]));
5097
5098 if (state->has_bindless()) {
5099 ast_type_qualifier input_layout_mask;
5100
5101 /* Allow to declare qualifiers for images. */
5102 input_layout_mask.flags.i = 0;
5103 input_layout_mask.flags.q.coherent = 1;
5104 input_layout_mask.flags.q._volatile = 1;
5105 input_layout_mask.flags.q.restrict_flag = 1;
5106 input_layout_mask.flags.q.read_only = 1;
5107 input_layout_mask.flags.q.write_only = 1;
5108 input_layout_mask.flags.q.explicit_image_format = 1;
5109
5110 if ((type->qualifier.flags.i & ~input_layout_mask.flags.i) != 0) {
5111 _mesa_glsl_error(&(yylsp[-2]), state,
5112 "only precision and image qualifiers may be "
5113 "applied to structure members");
5114 }
5115 } else {
5116 if (type->qualifier.flags.i != 0)
5117 _mesa_glsl_error(&(yylsp[-2]), state,
5118 "only precision qualifiers may be applied to "
5119 "structure members");
5120 }
5121
5122 (yyval.declarator_list) = new(ctx) ast_declarator_list(type);
5123 (yyval.declarator_list)->set_location((yylsp[-1]));
5124
5125 (yyval.declarator_list)->declarations.push_degenerate_list_at_head(& (yyvsp[-1].declaration)->link);
5126 }
5127 #line 5128 "src/compiler/glsl/glsl_parser.cpp"
5128 break;
5129
5130 case 218:
5131 #line 2465 "src/compiler/glsl/glsl_parser.yy"
5132 {
5133 (yyval.declaration) = (yyvsp[0].declaration);
5134 (yyvsp[0].declaration)->link.self_link();
5135 }
5136 #line 5137 "src/compiler/glsl/glsl_parser.cpp"
5137 break;
5138
5139 case 219:
5140 #line 2470 "src/compiler/glsl/glsl_parser.yy"
5141 {
5142 (yyval.declaration) = (yyvsp[-2].declaration);
5143 (yyval.declaration)->link.insert_before(& (yyvsp[0].declaration)->link);
5144 }
5145 #line 5146 "src/compiler/glsl/glsl_parser.cpp"
5146 break;
5147
5148 case 220:
5149 #line 2478 "src/compiler/glsl/glsl_parser.yy"
5150 {
5151 void *ctx = state->linalloc;
5152 (yyval.declaration) = new(ctx) ast_declaration((yyvsp[0].identifier), NULL, NULL);
5153 (yyval.declaration)->set_location((yylsp[0]));
5154 }
5155 #line 5156 "src/compiler/glsl/glsl_parser.cpp"
5156 break;
5157
5158 case 221:
5159 #line 2484 "src/compiler/glsl/glsl_parser.yy"
5160 {
5161 void *ctx = state->linalloc;
5162 (yyval.declaration) = new(ctx) ast_declaration((yyvsp[-1].identifier), (yyvsp[0].array_specifier), NULL);
5163 (yyval.declaration)->set_location_range((yylsp[-1]), (yylsp[0]));
5164 }
5165 #line 5166 "src/compiler/glsl/glsl_parser.cpp"
5166 break;
5167
5168 case 223:
5169 #line 2494 "src/compiler/glsl/glsl_parser.yy"
5170 {
5171 (yyval.expression) = (yyvsp[-1].expression);
5172 }
5173 #line 5174 "src/compiler/glsl/glsl_parser.cpp"
5174 break;
5175
5176 case 224:
5177 #line 2498 "src/compiler/glsl/glsl_parser.yy"
5178 {
5179 (yyval.expression) = (yyvsp[-2].expression);
5180 }
5181 #line 5182 "src/compiler/glsl/glsl_parser.cpp"
5182 break;
5183
5184 case 225:
5185 #line 2505 "src/compiler/glsl/glsl_parser.yy"
5186 {
5187 void *ctx = state->linalloc;
5188 (yyval.expression) = new(ctx) ast_aggregate_initializer();
5189 (yyval.expression)->set_location((yylsp[0]));
5190 (yyval.expression)->expressions.push_tail(& (yyvsp[0].expression)->link);
5191 }
5192 #line 5193 "src/compiler/glsl/glsl_parser.cpp"
5193 break;
5194
5195 case 226:
5196 #line 2512 "src/compiler/glsl/glsl_parser.yy"
5197 {
5198 (yyvsp[-2].expression)->expressions.push_tail(& (yyvsp[0].expression)->link);
5199 }
5200 #line 5201 "src/compiler/glsl/glsl_parser.cpp"
5201 break;
5202
5203 case 228:
5204 #line 2524 "src/compiler/glsl/glsl_parser.yy"
5205 { (yyval.node) = (ast_node *) (yyvsp[0].compound_statement); }
5206 #line 5207 "src/compiler/glsl/glsl_parser.cpp"
5207 break;
5208
5209 case 237:
5210 #line 2540 "src/compiler/glsl/glsl_parser.yy"
5211 {
5212 void *ctx = state->linalloc;
5213 (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL);
5214 (yyval.compound_statement)->set_location_range((yylsp[-1]), (yylsp[0]));
5215 }
5216 #line 5217 "src/compiler/glsl/glsl_parser.cpp"
5217 break;
5218
5219 case 238:
5220 #line 2546 "src/compiler/glsl/glsl_parser.yy"
5221 {
5222 state->symbols->push_scope();
5223 }
5224 #line 5225 "src/compiler/glsl/glsl_parser.cpp"
5225 break;
5226
5227 case 239:
5228 #line 2550 "src/compiler/glsl/glsl_parser.yy"
5229 {
5230 void *ctx = state->linalloc;
5231 (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[-1].node));
5232 (yyval.compound_statement)->set_location_range((yylsp[-3]), (yylsp[0]));
5233 state->symbols->pop_scope();
5234 }
5235 #line 5236 "src/compiler/glsl/glsl_parser.cpp"
5236 break;
5237
5238 case 240:
5239 #line 2559 "src/compiler/glsl/glsl_parser.yy"
5240 { (yyval.node) = (ast_node *) (yyvsp[0].compound_statement); }
5241 #line 5242 "src/compiler/glsl/glsl_parser.cpp"
5242 break;
5243
5244 case 242:
5245 #line 2565 "src/compiler/glsl/glsl_parser.yy"
5246 {
5247 void *ctx = state->linalloc;
5248 (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL);
5249 (yyval.compound_statement)->set_location_range((yylsp[-1]), (yylsp[0]));
5250 }
5251 #line 5252 "src/compiler/glsl/glsl_parser.cpp"
5252 break;
5253
5254 case 243:
5255 #line 2571 "src/compiler/glsl/glsl_parser.yy"
5256 {
5257 void *ctx = state->linalloc;
5258 (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[-1].node));
5259 (yyval.compound_statement)->set_location_range((yylsp[-2]), (yylsp[0]));
5260 }
5261 #line 5262 "src/compiler/glsl/glsl_parser.cpp"
5262 break;
5263
5264 case 244:
5265 #line 2580 "src/compiler/glsl/glsl_parser.yy"
5266 {
5267 if ((yyvsp[0].node) == NULL) {
5268 _mesa_glsl_error(& (yylsp[0]), state, "<nil> statement");
5269 assert((yyvsp[0].node) != NULL);
5270 }
5271
5272 (yyval.node) = (yyvsp[0].node);
5273 (yyval.node)->link.self_link();
5274 }
5275 #line 5276 "src/compiler/glsl/glsl_parser.cpp"
5276 break;
5277
5278 case 245:
5279 #line 2590 "src/compiler/glsl/glsl_parser.yy"
5280 {
5281 if ((yyvsp[0].node) == NULL) {
5282 _mesa_glsl_error(& (yylsp[0]), state, "<nil> statement");
5283 assert((yyvsp[0].node) != NULL);
5284 }
5285 (yyval.node) = (yyvsp[-1].node);
5286 (yyval.node)->link.insert_before(& (yyvsp[0].node)->link);
5287 }
5288 #line 5289 "src/compiler/glsl/glsl_parser.cpp"
5289 break;
5290
5291 case 246:
5292 #line 2599 "src/compiler/glsl/glsl_parser.yy"
5293 {
5294 if (!state->allow_extension_directive_midshader) {
5295 _mesa_glsl_error(& (yylsp[-1]), state,
5296 "#extension directive is not allowed "
5297 "in the middle of a shader");
5298 YYERROR;
5299 }
5300 }
5301 #line 5302 "src/compiler/glsl/glsl_parser.cpp"
5302 break;
5303
5304 case 247:
5305 #line 2611 "src/compiler/glsl/glsl_parser.yy"
5306 {
5307 void *ctx = state->linalloc;
5308 (yyval.node) = new(ctx) ast_expression_statement(NULL);
5309 (yyval.node)->set_location((yylsp[0]));
5310 }
5311 #line 5312 "src/compiler/glsl/glsl_parser.cpp"
5312 break;
5313
5314 case 248:
5315 #line 2617 "src/compiler/glsl/glsl_parser.yy"
5316 {
5317 void *ctx = state->linalloc;
5318 (yyval.node) = new(ctx) ast_expression_statement((yyvsp[-1].expression));
5319 (yyval.node)->set_location((yylsp[-1]));
5320 }
5321 #line 5322 "src/compiler/glsl/glsl_parser.cpp"
5322 break;
5323
5324 case 249:
5325 #line 2626 "src/compiler/glsl/glsl_parser.yy"
5326 {
5327 (yyval.node) = new(state->linalloc) ast_selection_statement((yyvsp[-2].expression), (yyvsp[0].selection_rest_statement).then_statement,
5328 (yyvsp[0].selection_rest_statement).else_statement);
5329 (yyval.node)->set_location_range((yylsp[-4]), (yylsp[0]));
5330 }
5331 #line 5332 "src/compiler/glsl/glsl_parser.cpp"
5332 break;
5333
5334 case 250:
5335 #line 2635 "src/compiler/glsl/glsl_parser.yy"
5336 {
5337 (yyval.selection_rest_statement).then_statement = (yyvsp[-2].node);
5338 (yyval.selection_rest_statement).else_statement = (yyvsp[0].node);
5339 }
5340 #line 5341 "src/compiler/glsl/glsl_parser.cpp"
5341 break;
5342
5343 case 251:
5344 #line 2640 "src/compiler/glsl/glsl_parser.yy"
5345 {
5346 (yyval.selection_rest_statement).then_statement = (yyvsp[0].node);
5347 (yyval.selection_rest_statement).else_statement = NULL;
5348 }
5349 #line 5350 "src/compiler/glsl/glsl_parser.cpp"
5350 break;
5351
5352 case 252:
5353 #line 2648 "src/compiler/glsl/glsl_parser.yy"
5354 {
5355 (yyval.node) = (ast_node *) (yyvsp[0].expression);
5356 }
5357 #line 5358 "src/compiler/glsl/glsl_parser.cpp"
5358 break;
5359
5360 case 253:
5361 #line 2652 "src/compiler/glsl/glsl_parser.yy"
5362 {
5363 void *ctx = state->linalloc;
5364 ast_declaration *decl = new(ctx) ast_declaration((yyvsp[-2].identifier), NULL, (yyvsp[0].expression));
5365 ast_declarator_list *declarator = new(ctx) ast_declarator_list((yyvsp[-3].fully_specified_type));
5366 decl->set_location_range((yylsp[-2]), (yylsp[0]));
5367 declarator->set_location((yylsp[-3]));
5368
5369 declarator->declarations.push_tail(&decl->link);
5370 (yyval.node) = declarator;
5371 }
5372 #line 5373 "src/compiler/glsl/glsl_parser.cpp"
5373 break;
5374
5375 case 254:
5376 #line 2670 "src/compiler/glsl/glsl_parser.yy"
5377 {
5378 (yyval.node) = new(state->linalloc) ast_switch_statement((yyvsp[-2].expression), (yyvsp[0].switch_body));
5379 (yyval.node)->set_location_range((yylsp[-4]), (yylsp[0]));
5380 }
5381 #line 5382 "src/compiler/glsl/glsl_parser.cpp"
5382 break;
5383
5384 case 255:
5385 #line 2678 "src/compiler/glsl/glsl_parser.yy"
5386 {
5387 (yyval.switch_body) = new(state->linalloc) ast_switch_body(NULL);
5388 (yyval.switch_body)->set_location_range((yylsp[-1]), (yylsp[0]));
5389 }
5390 #line 5391 "src/compiler/glsl/glsl_parser.cpp"
5391 break;
5392
5393 case 256:
5394 #line 2683 "src/compiler/glsl/glsl_parser.yy"
5395 {
5396 (yyval.switch_body) = new(state->linalloc) ast_switch_body((yyvsp[-1].case_statement_list));
5397 (yyval.switch_body)->set_location_range((yylsp[-2]), (yylsp[0]));
5398 }
5399 #line 5400 "src/compiler/glsl/glsl_parser.cpp"
5400 break;
5401
5402 case 257:
5403 #line 2691 "src/compiler/glsl/glsl_parser.yy"
5404 {
5405 (yyval.case_label) = new(state->linalloc) ast_case_label((yyvsp[-1].expression));
5406 (yyval.case_label)->set_location((yylsp[-1]));
5407 }
5408 #line 5409 "src/compiler/glsl/glsl_parser.cpp"
5409 break;
5410
5411 case 258:
5412 #line 2696 "src/compiler/glsl/glsl_parser.yy"
5413 {
5414 (yyval.case_label) = new(state->linalloc) ast_case_label(NULL);
5415 (yyval.case_label)->set_location((yylsp[0]));
5416 }
5417 #line 5418 "src/compiler/glsl/glsl_parser.cpp"
5418 break;
5419
5420 case 259:
5421 #line 2704 "src/compiler/glsl/glsl_parser.yy"
5422 {
5423 ast_case_label_list *labels = new(state->linalloc) ast_case_label_list();
5424
5425 labels->labels.push_tail(& (yyvsp[0].case_label)->link);
5426 (yyval.case_label_list) = labels;
5427 (yyval.case_label_list)->set_location((yylsp[0]));
5428 }
5429 #line 5430 "src/compiler/glsl/glsl_parser.cpp"
5430 break;
5431
5432 case 260:
5433 #line 2712 "src/compiler/glsl/glsl_parser.yy"
5434 {
5435 (yyval.case_label_list) = (yyvsp[-1].case_label_list);
5436 (yyval.case_label_list)->labels.push_tail(& (yyvsp[0].case_label)->link);
5437 }
5438 #line 5439 "src/compiler/glsl/glsl_parser.cpp"
5439 break;
5440
5441 case 261:
5442 #line 2720 "src/compiler/glsl/glsl_parser.yy"
5443 {
5444 ast_case_statement *stmts = new(state->linalloc) ast_case_statement((yyvsp[-1].case_label_list));
5445 stmts->set_location((yylsp[0]));
5446
5447 stmts->stmts.push_tail(& (yyvsp[0].node)->link);
5448 (yyval.case_statement) = stmts;
5449 }
5450 #line 5451 "src/compiler/glsl/glsl_parser.cpp"
5451 break;
5452
5453 case 262:
5454 #line 2728 "src/compiler/glsl/glsl_parser.yy"
5455 {
5456 (yyval.case_statement) = (yyvsp[-1].case_statement);
5457 (yyval.case_statement)->stmts.push_tail(& (yyvsp[0].node)->link);
5458 }
5459 #line 5460 "src/compiler/glsl/glsl_parser.cpp"
5460 break;
5461
5462 case 263:
5463 #line 2736 "src/compiler/glsl/glsl_parser.yy"
5464 {
5465 ast_case_statement_list *cases= new(state->linalloc) ast_case_statement_list();
5466 cases->set_location((yylsp[0]));
5467
5468 cases->cases.push_tail(& (yyvsp[0].case_statement)->link);
5469 (yyval.case_statement_list) = cases;
5470 }
5471 #line 5472 "src/compiler/glsl/glsl_parser.cpp"
5472 break;
5473
5474 case 264:
5475 #line 2744 "src/compiler/glsl/glsl_parser.yy"
5476 {
5477 (yyval.case_statement_list) = (yyvsp[-1].case_statement_list);
5478 (yyval.case_statement_list)->cases.push_tail(& (yyvsp[0].case_statement)->link);
5479 }
5480 #line 5481 "src/compiler/glsl/glsl_parser.cpp"
5481 break;
5482
5483 case 265:
5484 #line 2752 "src/compiler/glsl/glsl_parser.yy"
5485 {
5486 void *ctx = state->linalloc;
5487 (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while,
5488 NULL, (yyvsp[-2].node), NULL, (yyvsp[0].node));
5489 (yyval.node)->set_location_range((yylsp[-4]), (yylsp[-1]));
5490 }
5491 #line 5492 "src/compiler/glsl/glsl_parser.cpp"
5492 break;
5493
5494 case 266:
5495 #line 2759 "src/compiler/glsl/glsl_parser.yy"
5496 {
5497 void *ctx = state->linalloc;
5498 (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while,
5499 NULL, (yyvsp[-2].expression), NULL, (yyvsp[-5].node));
5500 (yyval.node)->set_location_range((yylsp[-6]), (yylsp[-1]));
5501 }
5502 #line 5503 "src/compiler/glsl/glsl_parser.cpp"
5503 break;
5504
5505 case 267:
5506 #line 2766 "src/compiler/glsl/glsl_parser.yy"
5507 {
5508 void *ctx = state->linalloc;
5509 (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for,
5510 (yyvsp[-3].node), (yyvsp[-2].for_rest_statement).cond, (yyvsp[-2].for_rest_statement).rest, (yyvsp[0].node));
5511 (yyval.node)->set_location_range((yylsp[-5]), (yylsp[0]));
5512 }
5513 #line 5514 "src/compiler/glsl/glsl_parser.cpp"
5514 break;
5515
5516 case 271:
5517 #line 2782 "src/compiler/glsl/glsl_parser.yy"
5518 {
5519 (yyval.node) = NULL;
5520 }
5521 #line 5522 "src/compiler/glsl/glsl_parser.cpp"
5522 break;
5523
5524 case 272:
5525 #line 2789 "src/compiler/glsl/glsl_parser.yy"
5526 {
5527 (yyval.for_rest_statement).cond = (yyvsp[-1].node);
5528 (yyval.for_rest_statement).rest = NULL;
5529 }
5530 #line 5531 "src/compiler/glsl/glsl_parser.cpp"
5531 break;
5532
5533 case 273:
5534 #line 2794 "src/compiler/glsl/glsl_parser.yy"
5535 {
5536 (yyval.for_rest_statement).cond = (yyvsp[-2].node);
5537 (yyval.for_rest_statement).rest = (yyvsp[0].expression);
5538 }
5539 #line 5540 "src/compiler/glsl/glsl_parser.cpp"
5540 break;
5541
5542 case 274:
5543 #line 2803 "src/compiler/glsl/glsl_parser.yy"
5544 {
5545 void *ctx = state->linalloc;
5546 (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL);
5547 (yyval.node)->set_location((yylsp[-1]));
5548 }
5549 #line 5550 "src/compiler/glsl/glsl_parser.cpp"
5550 break;
5551
5552 case 275:
5553 #line 2809 "src/compiler/glsl/glsl_parser.yy"
5554 {
5555 void *ctx = state->linalloc;
5556 (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL);
5557 (yyval.node)->set_location((yylsp[-1]));
5558 }
5559 #line 5560 "src/compiler/glsl/glsl_parser.cpp"
5560 break;
5561
5562 case 276:
5563 #line 2815 "src/compiler/glsl/glsl_parser.yy"
5564 {
5565 void *ctx = state->linalloc;
5566 (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL);
5567 (yyval.node)->set_location((yylsp[-1]));
5568 }
5569 #line 5570 "src/compiler/glsl/glsl_parser.cpp"
5570 break;
5571
5572 case 277:
5573 #line 2821 "src/compiler/glsl/glsl_parser.yy"
5574 {
5575 void *ctx = state->linalloc;
5576 (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[-1].expression));
5577 (yyval.node)->set_location_range((yylsp[-2]), (yylsp[-1]));
5578 }
5579 #line 5580 "src/compiler/glsl/glsl_parser.cpp"
5580 break;
5581
5582 case 278:
5583 #line 2827 "src/compiler/glsl/glsl_parser.yy"
5584 {
5585 void *ctx = state->linalloc;
5586 (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL);
5587 (yyval.node)->set_location((yylsp[-1]));
5588 }
5589 #line 5590 "src/compiler/glsl/glsl_parser.cpp"
5590 break;
5591
5592 case 279:
5593 #line 2836 "src/compiler/glsl/glsl_parser.yy"
5594 {
5595 void *ctx = state->linalloc;
5596 (yyval.node) = new(ctx) ast_demote_statement();
5597 (yyval.node)->set_location((yylsp[-1]));
5598 }
5599 #line 5600 "src/compiler/glsl/glsl_parser.cpp"
5600 break;
5601
5602 case 280:
5603 #line 2844 "src/compiler/glsl/glsl_parser.yy"
5604 { (yyval.node) = (yyvsp[0].function_definition); }
5605 #line 5606 "src/compiler/glsl/glsl_parser.cpp"
5606 break;
5607
5608 case 281:
5609 #line 2845 "src/compiler/glsl/glsl_parser.yy"
5610 { (yyval.node) = (yyvsp[0].node); }
5611 #line 5612 "src/compiler/glsl/glsl_parser.cpp"
5612 break;
5613
5614 case 282:
5615 #line 2846 "src/compiler/glsl/glsl_parser.yy"
5616 { (yyval.node) = (yyvsp[0].node); }
5617 #line 5618 "src/compiler/glsl/glsl_parser.cpp"
5618 break;
5619
5620 case 283:
5621 #line 2847 "src/compiler/glsl/glsl_parser.yy"
5622 { (yyval.node) = (yyvsp[0].node); }
5623 #line 5624 "src/compiler/glsl/glsl_parser.cpp"
5624 break;
5625
5626 case 284:
5627 #line 2848 "src/compiler/glsl/glsl_parser.yy"
5628 { (yyval.node) = NULL; }
5629 #line 5630 "src/compiler/glsl/glsl_parser.cpp"
5630 break;
5631
5632 case 285:
5633 #line 2853 "src/compiler/glsl/glsl_parser.yy"
5634 {
5635 void *ctx = state->linalloc;
5636 (yyval.function_definition) = new(ctx) ast_function_definition();
5637 (yyval.function_definition)->set_location_range((yylsp[-1]), (yylsp[0]));
5638 (yyval.function_definition)->prototype = (yyvsp[-1].function);
5639 (yyval.function_definition)->body = (yyvsp[0].compound_statement);
5640
5641 state->symbols->pop_scope();
5642 }
5643 #line 5644 "src/compiler/glsl/glsl_parser.cpp"
5644 break;
5645
5646 case 286:
5647 #line 2867 "src/compiler/glsl/glsl_parser.yy"
5648 {
5649 (yyval.node) = (yyvsp[0].interface_block);
5650 }
5651 #line 5652 "src/compiler/glsl/glsl_parser.cpp"
5652 break;
5653
5654 case 287:
5655 #line 2871 "src/compiler/glsl/glsl_parser.yy"
5656 {
5657 ast_interface_block *block = (ast_interface_block *) (yyvsp[0].node);
5658
5659 if (!(yyvsp[-1].type_qualifier).merge_qualifier(& (yylsp[-1]), state, block->layout, false,
5660 block->layout.has_layout())) {
5661 YYERROR;
5662 }
5663
5664 block->layout = (yyvsp[-1].type_qualifier);
5665
5666 (yyval.node) = block;
5667 }
5668 #line 5669 "src/compiler/glsl/glsl_parser.cpp"
5669 break;
5670
5671 case 288:
5672 #line 2884 "src/compiler/glsl/glsl_parser.yy"
5673 {
5674 ast_interface_block *block = (ast_interface_block *)(yyvsp[0].node);
5675
5676 if (!block->default_layout.flags.q.buffer) {
5677 _mesa_glsl_error(& (yylsp[-1]), state,
5678 "memory qualifiers can only be used in the "
5679 "declaration of shader storage blocks");
5680 }
5681 if (!(yyvsp[-1].type_qualifier).merge_qualifier(& (yylsp[-1]), state, block->layout, false)) {
5682 YYERROR;
5683 }
5684 block->layout = (yyvsp[-1].type_qualifier);
5685 (yyval.node) = block;
5686 }
5687 #line 5688 "src/compiler/glsl/glsl_parser.cpp"
5688 break;
5689
5690 case 289:
5691 #line 2902 "src/compiler/glsl/glsl_parser.yy"
5692 {
5693 ast_interface_block *const block = (yyvsp[-1].interface_block);
5694
5695 if ((yyvsp[-6].type_qualifier).flags.q.uniform) {
5696 block->default_layout = *state->default_uniform_qualifier;
5697 } else if ((yyvsp[-6].type_qualifier).flags.q.buffer) {
5698 block->default_layout = *state->default_shader_storage_qualifier;
5699 }
5700 block->block_name = (yyvsp[-5].identifier);
5701 block->declarations.push_degenerate_list_at_head(& (yyvsp[-3].declarator_list)->link);
5702
5703 _mesa_ast_process_interface_block(& (yylsp[-6]), state, block, (yyvsp[-6].type_qualifier));
5704
5705 (yyval.interface_block) = block;
5706 }
5707 #line 5708 "src/compiler/glsl/glsl_parser.cpp"
5708 break;
5709
5710 case 290:
5711 #line 2921 "src/compiler/glsl/glsl_parser.yy"
5712 {
5713 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
5714 (yyval.type_qualifier).flags.q.in = 1;
5715 }
5716 #line 5717 "src/compiler/glsl/glsl_parser.cpp"
5717 break;
5718
5719 case 291:
5720 #line 2926 "src/compiler/glsl/glsl_parser.yy"
5721 {
5722 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
5723 (yyval.type_qualifier).flags.q.out = 1;
5724 }
5725 #line 5726 "src/compiler/glsl/glsl_parser.cpp"
5726 break;
5727
5728 case 292:
5729 #line 2931 "src/compiler/glsl/glsl_parser.yy"
5730 {
5731 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
5732 (yyval.type_qualifier).flags.q.uniform = 1;
5733 }
5734 #line 5735 "src/compiler/glsl/glsl_parser.cpp"
5735 break;
5736
5737 case 293:
5738 #line 2936 "src/compiler/glsl/glsl_parser.yy"
5739 {
5740 memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
5741 (yyval.type_qualifier).flags.q.buffer = 1;
5742 }
5743 #line 5744 "src/compiler/glsl/glsl_parser.cpp"
5744 break;
5745
5746 case 294:
5747 #line 2941 "src/compiler/glsl/glsl_parser.yy"
5748 {
5749 if (!(yyvsp[-1].type_qualifier).flags.q.patch) {
5750 _mesa_glsl_error(&(yylsp[-1]), state, "invalid interface qualifier");
5751 }
5752 if ((yyvsp[0].type_qualifier).has_auxiliary_storage()) {
5753 _mesa_glsl_error(&(yylsp[-1]), state, "duplicate patch qualifier");
5754 }
5755 (yyval.type_qualifier) = (yyvsp[0].type_qualifier);
5756 (yyval.type_qualifier).flags.q.patch = 1;
5757 }
5758 #line 5759 "src/compiler/glsl/glsl_parser.cpp"
5759 break;
5760
5761 case 295:
5762 #line 2955 "src/compiler/glsl/glsl_parser.yy"
5763 {
5764 (yyval.interface_block) = new(state->linalloc) ast_interface_block(NULL, NULL);
5765 }
5766 #line 5767 "src/compiler/glsl/glsl_parser.cpp"
5767 break;
5768
5769 case 296:
5770 #line 2959 "src/compiler/glsl/glsl_parser.yy"
5771 {
5772 (yyval.interface_block) = new(state->linalloc) ast_interface_block((yyvsp[0].identifier), NULL);
5773 (yyval.interface_block)->set_location((yylsp[0]));
5774 }
5775 #line 5776 "src/compiler/glsl/glsl_parser.cpp"
5776 break;
5777
5778 case 297:
5779 #line 2964 "src/compiler/glsl/glsl_parser.yy"
5780 {
5781 (yyval.interface_block) = new(state->linalloc) ast_interface_block((yyvsp[-1].identifier), (yyvsp[0].array_specifier));
5782 (yyval.interface_block)->set_location_range((yylsp[-1]), (yylsp[0]));
5783 }
5784 #line 5785 "src/compiler/glsl/glsl_parser.cpp"
5785 break;
5786
5787 case 298:
5788 #line 2972 "src/compiler/glsl/glsl_parser.yy"
5789 {
5790 (yyval.declarator_list) = (yyvsp[0].declarator_list);
5791 (yyvsp[0].declarator_list)->link.self_link();
5792 }
5793 #line 5794 "src/compiler/glsl/glsl_parser.cpp"
5794 break;
5795
5796 case 299:
5797 #line 2977 "src/compiler/glsl/glsl_parser.yy"
5798 {
5799 (yyval.declarator_list) = (yyvsp[-1].declarator_list);
5800 (yyvsp[0].declarator_list)->link.insert_before(& (yyval.declarator_list)->link);
5801 }
5802 #line 5803 "src/compiler/glsl/glsl_parser.cpp"
5803 break;
5804
5805 case 300:
5806 #line 2985 "src/compiler/glsl/glsl_parser.yy"
5807 {
5808 void *ctx = state->linalloc;
5809 ast_fully_specified_type *type = (yyvsp[-2].fully_specified_type);
5810 type->set_location((yylsp[-2]));
5811
5812 if (type->qualifier.flags.q.attribute) {
5813 _mesa_glsl_error(& (yylsp[-2]), state,
5814 "keyword 'attribute' cannot be used with "
5815 "interface block member");
5816 } else if (type->qualifier.flags.q.varying) {
5817 _mesa_glsl_error(& (yylsp[-2]), state,
5818 "keyword 'varying' cannot be used with "
5819 "interface block member");
5820 }
5821
5822 (yyval.declarator_list) = new(ctx) ast_declarator_list(type);
5823 (yyval.declarator_list)->set_location((yylsp[-1]));
5824
5825 (yyval.declarator_list)->declarations.push_degenerate_list_at_head(& (yyvsp[-1].declaration)->link);
5826 }
5827 #line 5828 "src/compiler/glsl/glsl_parser.cpp"
5828 break;
5829
5830 case 301:
5831 #line 3009 "src/compiler/glsl/glsl_parser.yy"
5832 {
5833 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
5834 if (!(yyval.type_qualifier).merge_qualifier(& (yylsp[-1]), state, (yyvsp[0].type_qualifier), false, true)) {
5835 YYERROR;
5836 }
5837 }
5838 #line 5839 "src/compiler/glsl/glsl_parser.cpp"
5839 break;
5840
5841 case 303:
5842 #line 3020 "src/compiler/glsl/glsl_parser.yy"
5843 {
5844 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
5845 if (!(yyval.type_qualifier).merge_qualifier(& (yylsp[-1]), state, (yyvsp[0].type_qualifier), false, true)) {
5846 YYERROR;
5847 }
5848 }
5849 #line 5850 "src/compiler/glsl/glsl_parser.cpp"
5850 break;
5851
5852 case 305:
5853 #line 3031 "src/compiler/glsl/glsl_parser.yy"
5854 {
5855 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
5856 if (!(yyval.type_qualifier).merge_qualifier(& (yylsp[-1]), state, (yyvsp[0].type_qualifier), false, true)) {
5857 YYERROR;
5858 }
5859 if (!(yyval.type_qualifier).validate_in_qualifier(& (yylsp[-1]), state)) {
5860 YYERROR;
5861 }
5862 }
5863 #line 5864 "src/compiler/glsl/glsl_parser.cpp"
5864 break;
5865
5866 case 306:
5867 #line 3041 "src/compiler/glsl/glsl_parser.yy"
5868 {
5869 if (!(yyvsp[-2].type_qualifier).validate_in_qualifier(& (yylsp[-2]), state)) {
5870 YYERROR;
5871 }
5872 }
5873 #line 5874 "src/compiler/glsl/glsl_parser.cpp"
5874 break;
5875
5876 case 307:
5877 #line 3050 "src/compiler/glsl/glsl_parser.yy"
5878 {
5879 (yyval.type_qualifier) = (yyvsp[-1].type_qualifier);
5880 if (!(yyval.type_qualifier).merge_qualifier(& (yylsp[-1]), state, (yyvsp[0].type_qualifier), false, true)) {
5881 YYERROR;
5882 }
5883 if (!(yyval.type_qualifier).validate_out_qualifier(& (yylsp[-1]), state)) {
5884 YYERROR;
5885 }
5886 }
5887 #line 5888 "src/compiler/glsl/glsl_parser.cpp"
5888 break;
5889
5890 case 308:
5891 #line 3060 "src/compiler/glsl/glsl_parser.yy"
5892 {
5893 if (!(yyvsp[-2].type_qualifier).validate_out_qualifier(& (yylsp[-2]), state)) {
5894 YYERROR;
5895 }
5896 }
5897 #line 5898 "src/compiler/glsl/glsl_parser.cpp"
5898 break;
5899
5900 case 309:
5901 #line 3069 "src/compiler/glsl/glsl_parser.yy"
5902 {
5903 (yyval.node) = NULL;
5904 if (!state->default_uniform_qualifier->
5905 merge_qualifier(& (yylsp[0]), state, (yyvsp[0].type_qualifier), false)) {
5906 YYERROR;
5907 }
5908 if (!state->default_uniform_qualifier->
5909 push_to_global(& (yylsp[0]), state)) {
5910 YYERROR;
5911 }
5912 }
5913 #line 5914 "src/compiler/glsl/glsl_parser.cpp"
5914 break;
5915
5916 case 310:
5917 #line 3081 "src/compiler/glsl/glsl_parser.yy"
5918 {
5919 (yyval.node) = NULL;
5920 if (!state->default_shader_storage_qualifier->
5921 merge_qualifier(& (yylsp[0]), state, (yyvsp[0].type_qualifier), false)) {
5922 YYERROR;
5923 }
5924 if (!state->default_shader_storage_qualifier->
5925 push_to_global(& (yylsp[0]), state)) {
5926 YYERROR;
5927 }
5928
5929 /* From the GLSL 4.50 spec, section 4.4.5:
5930 *
5931 * "It is a compile-time error to specify the binding identifier for
5932 * the global scope or for block member declarations."
5933 */
5934 if (state->default_shader_storage_qualifier->flags.q.explicit_binding) {
5935 _mesa_glsl_error(& (yylsp[0]), state,
5936 "binding qualifier cannot be set for default layout");
5937 }
5938 }
5939 #line 5940 "src/compiler/glsl/glsl_parser.cpp"
5940 break;
5941
5942 case 311:
5943 #line 3103 "src/compiler/glsl/glsl_parser.yy"
5944 {
5945 (yyval.node) = NULL;
5946 if (!(yyvsp[0].type_qualifier).merge_into_in_qualifier(& (yylsp[0]), state, (yyval.node))) {
5947 YYERROR;
5948 }
5949 if (!state->in_qualifier->push_to_global(& (yylsp[0]), state)) {
5950 YYERROR;
5951 }
5952 }
5953 #line 5954 "src/compiler/glsl/glsl_parser.cpp"
5954 break;
5955
5956 case 312:
5957 #line 3113 "src/compiler/glsl/glsl_parser.yy"
5958 {
5959 (yyval.node) = NULL;
5960 if (!(yyvsp[0].type_qualifier).merge_into_out_qualifier(& (yylsp[0]), state, (yyval.node))) {
5961 YYERROR;
5962 }
5963 if (!state->out_qualifier->push_to_global(& (yylsp[0]), state)) {
5964 YYERROR;
5965 }
5966 }
5967 #line 5968 "src/compiler/glsl/glsl_parser.cpp"
5968 break;
5969
5970
5971 #line 5972 "src/compiler/glsl/glsl_parser.cpp"
5972
5973 default: break;
5974 }
5975 /* User semantic actions sometimes alter yychar, and that requires
5976 that yytoken be updated with the new translation. We take the
5977 approach of translating immediately before every use of yytoken.
5978 One alternative is translating here after every semantic action,
5979 but that translation would be missed if the semantic action invokes
5980 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
5981 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
5982 incorrect destructor might then be invoked immediately. In the
5983 case of YYERROR or YYBACKUP, subsequent parser actions might lead
5984 to an incorrect destructor call or verbose syntax error message
5985 before the lookahead is translated. */
5986 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
5987
5988 YYPOPSTACK (yylen);
5989 yylen = 0;
5990 YY_STACK_PRINT (yyss, yyssp);
5991
5992 *++yyvsp = yyval;
5993 *++yylsp = yyloc;
5994
5995 /* Now 'shift' the result of the reduction. Determine what state
5996 that goes to, based on the state we popped back to and the rule
5997 number reduced by. */
5998 {
5999 const int yylhs = yyr1[yyn] - YYNTOKENS;
6000 const int yyi = yypgoto[yylhs] + *yyssp;
6001 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
6002 ? yytable[yyi]
6003 : yydefgoto[yylhs]);
6004 }
6005
6006 goto yynewstate;
6007
6008
6009 /*--------------------------------------.
6010 | yyerrlab -- here on detecting error. |
6011 `--------------------------------------*/
6012 yyerrlab:
6013 /* Make sure we have latest lookahead translation. See comments at
6014 user semantic actions for why this is necessary. */
6015 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
6016
6017 /* If not already recovering from an error, report this error. */
6018 if (!yyerrstatus)
6019 {
6020 ++yynerrs;
6021 #if ! YYERROR_VERBOSE
6022 yyerror (&yylloc, state, YY_("syntax error"));
6023 #else
6024 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
6025 yyssp, yytoken)
6026 {
6027 char const *yymsgp = YY_("syntax error");
6028 int yysyntax_error_status;
6029 yysyntax_error_status = YYSYNTAX_ERROR;
6030 if (yysyntax_error_status == 0)
6031 yymsgp = yymsg;
6032 else if (yysyntax_error_status == 1)
6033 {
6034 if (yymsg != yymsgbuf)
6035 YYSTACK_FREE (yymsg);
6036 yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
6037 if (!yymsg)
6038 {
6039 yymsg = yymsgbuf;
6040 yymsg_alloc = sizeof yymsgbuf;
6041 yysyntax_error_status = 2;
6042 }
6043 else
6044 {
6045 yysyntax_error_status = YYSYNTAX_ERROR;
6046 yymsgp = yymsg;
6047 }
6048 }
6049 yyerror (&yylloc, state, yymsgp);
6050 if (yysyntax_error_status == 2)
6051 goto yyexhaustedlab;
6052 }
6053 # undef YYSYNTAX_ERROR
6054 #endif
6055 }
6056
6057 yyerror_range[1] = yylloc;
6058
6059 if (yyerrstatus == 3)
6060 {
6061 /* If just tried and failed to reuse lookahead token after an
6062 error, discard it. */
6063
6064 if (yychar <= YYEOF)
6065 {
6066 /* Return failure if at end of input. */
6067 if (yychar == YYEOF)
6068 YYABORT;
6069 }
6070 else
6071 {
6072 yydestruct ("Error: discarding",
6073 yytoken, &yylval, &yylloc, state);
6074 yychar = YYEMPTY;
6075 }
6076 }
6077
6078 /* Else will try to reuse lookahead token after shifting the error
6079 token. */
6080 goto yyerrlab1;
6081
6082
6083 /*---------------------------------------------------.
6084 | yyerrorlab -- error raised explicitly by YYERROR. |
6085 `---------------------------------------------------*/
6086 yyerrorlab:
6087 /* Pacify compilers when the user code never invokes YYERROR and the
6088 label yyerrorlab therefore never appears in user code. */
6089 if (0)
6090 YYERROR;
6091
6092 /* Do not reclaim the symbols of the rule whose action triggered
6093 this YYERROR. */
6094 YYPOPSTACK (yylen);
6095 yylen = 0;
6096 YY_STACK_PRINT (yyss, yyssp);
6097 yystate = *yyssp;
6098 goto yyerrlab1;
6099
6100
6101 /*-------------------------------------------------------------.
6102 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6103 `-------------------------------------------------------------*/
6104 yyerrlab1:
6105 yyerrstatus = 3; /* Each real token shifted decrements this. */
6106
6107 for (;;)
6108 {
6109 yyn = yypact[yystate];
6110 if (!yypact_value_is_default (yyn))
6111 {
6112 yyn += YYTERROR;
6113 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6114 {
6115 yyn = yytable[yyn];
6116 if (0 < yyn)
6117 break;
6118 }
6119 }
6120
6121 /* Pop the current state because it cannot handle the error token. */
6122 if (yyssp == yyss)
6123 YYABORT;
6124
6125 yyerror_range[1] = *yylsp;
6126 yydestruct ("Error: popping",
6127 yystos[yystate], yyvsp, yylsp, state);
6128 YYPOPSTACK (1);
6129 yystate = *yyssp;
6130 YY_STACK_PRINT (yyss, yyssp);
6131 }
6132
6133 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
6134 *++yyvsp = yylval;
6135 YY_IGNORE_MAYBE_UNINITIALIZED_END
6136
6137 yyerror_range[2] = yylloc;
6138 /* Using YYLLOC is tempting, but would change the location of
6139 the lookahead. YYLOC is available though. */
6140 YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
6141 *++yylsp = yyloc;
6142
6143 /* Shift the error token. */
6144 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6145
6146 yystate = yyn;
6147 goto yynewstate;
6148
6149
6150 /*-------------------------------------.
6151 | yyacceptlab -- YYACCEPT comes here. |
6152 `-------------------------------------*/
6153 yyacceptlab:
6154 yyresult = 0;
6155 goto yyreturn;
6156
6157
6158 /*-----------------------------------.
6159 | yyabortlab -- YYABORT comes here. |
6160 `-----------------------------------*/
6161 yyabortlab:
6162 yyresult = 1;
6163 goto yyreturn;
6164
6165
6166 #if !defined yyoverflow || YYERROR_VERBOSE
6167 /*-------------------------------------------------.
6168 | yyexhaustedlab -- memory exhaustion comes here. |
6169 `-------------------------------------------------*/
6170 yyexhaustedlab:
6171 yyerror (&yylloc, state, YY_("memory exhausted"));
6172 yyresult = 2;
6173 /* Fall through. */
6174 #endif
6175
6176
6177 /*-----------------------------------------------------.
6178 | yyreturn -- parsing is finished, return the result. |
6179 `-----------------------------------------------------*/
6180 yyreturn:
6181 if (yychar != YYEMPTY)
6182 {
6183 /* Make sure we have latest lookahead translation. See comments at
6184 user semantic actions for why this is necessary. */
6185 yytoken = YYTRANSLATE (yychar);
6186 yydestruct ("Cleanup: discarding lookahead",
6187 yytoken, &yylval, &yylloc, state);
6188 }
6189 /* Do not reclaim the symbols of the rule whose action triggered
6190 this YYABORT or YYACCEPT. */
6191 YYPOPSTACK (yylen);
6192 YY_STACK_PRINT (yyss, yyssp);
6193 while (yyssp != yyss)
6194 {
6195 yydestruct ("Cleanup: popping",
6196 yystos[*yyssp], yyvsp, yylsp, state);
6197 YYPOPSTACK (1);
6198 }
6199 #ifndef yyoverflow
6200 if (yyss != yyssa)
6201 YYSTACK_FREE (yyss);
6202 #endif
6203 #if YYERROR_VERBOSE
6204 if (yymsg != yymsgbuf)
6205 YYSTACK_FREE (yymsg);
6206 #endif
6207 return yyresult;
6208 }