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