Merge pull request #2985 from jeremy-lunarg/hayes-nonsemantic-shader-debuginfo-rebase
[platform/upstream/glslang.git] / glslang / MachineIndependent / glslang.m4
1 //
2 // Copyright (C) 2002-2005  3Dlabs Inc. Ltd.
3 // Copyright (C) 2012-2013 LunarG, Inc.
4 // Copyright (C) 2017 ARM Limited.
5 // Copyright (C) 2015-2019 Google, Inc.
6 // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
7 //
8 // All rights reserved.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions
12 // are met:
13 //
14 //    Redistributions of source code must retain the above copyright
15 //    notice, this list of conditions and the following disclaimer.
16 //
17 //    Redistributions in binary form must reproduce the above
18 //    copyright notice, this list of conditions and the following
19 //    disclaimer in the documentation and/or other materials provided
20 //    with the distribution.
21 //
22 //    Neither the name of 3Dlabs Inc. Ltd. nor the names of its
23 //    contributors may be used to endorse or promote products derived
24 //    from this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 // POSSIBILITY OF SUCH DAMAGE.
38 //
39
40 //
41 // Do not edit the .y file, only edit the .m4 file.
42 // The .y bison file is not a source file, it is a derivative of the .m4 file.
43 // The m4 file needs to be processed by m4 to generate the .y bison file.
44 //
45 // Code sandwiched between a pair:
46 //
47 //    GLSLANG_WEB_EXCLUDE_ON
48 //      ...
49 //      ...
50 //      ...
51 //    GLSLANG_WEB_EXCLUDE_OFF
52 //
53 // Will be excluded from the grammar when m4 is executed as:
54 //
55 //    m4 -P -DGLSLANG_WEB
56 //
57 // It will be included when m4 is executed as:
58 //
59 //    m4 -P
60 //
61
62 m4_define(`GLSLANG_WEB_EXCLUDE_ON', `m4_ifdef(`GLSLANG_WEB', `m4_divert(`-1')')')
63 m4_define(`GLSLANG_WEB_EXCLUDE_OFF', `m4_ifdef(`GLSLANG_WEB', `m4_divert')')
64
65 /**
66  * This is bison grammar and productions for parsing all versions of the
67  * GLSL shading languages.
68  */
69 %{
70
71 /* Based on:
72 ANSI C Yacc grammar
73
74 In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
75 matching Lex specification) for the April 30, 1985 draft version of the
76 ANSI C standard.  Tom Stockfisch reposted it to net.sources in 1987; that
77 original, as mentioned in the answer to question 17.25 of the comp.lang.c
78 FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
79
80 I intend to keep this version as close to the current C Standard grammar as
81 possible; please let me know if you discover discrepancies.
82
83 Jutta Degener, 1995
84 */
85
86 #include "SymbolTable.h"
87 #include "ParseHelper.h"
88 #include "../Public/ShaderLang.h"
89 #include "attribute.h"
90
91 using namespace glslang;
92
93 %}
94
95 %define parse.error verbose
96
97 %union {
98     struct {
99         glslang::TSourceLoc loc;
100         union {
101             glslang::TString *string;
102             int i;
103             unsigned int u;
104             long long i64;
105             unsigned long long u64;
106             bool b;
107             double d;
108         };
109         glslang::TSymbol* symbol;
110     } lex;
111     struct {
112         glslang::TSourceLoc loc;
113         glslang::TOperator op;
114         union {
115             TIntermNode* intermNode;
116             glslang::TIntermNodePair nodePair;
117             glslang::TIntermTyped* intermTypedNode;
118             glslang::TAttributes* attributes;
119             glslang::TSpirvRequirement* spirvReq;
120             glslang::TSpirvInstruction* spirvInst;
121             glslang::TSpirvTypeParameters* spirvTypeParams;
122         };
123         union {
124             glslang::TPublicType type;
125             glslang::TFunction* function;
126             glslang::TParameter param;
127             glslang::TTypeLoc typeLine;
128             glslang::TTypeList* typeList;
129             glslang::TArraySizes* arraySizes;
130             glslang::TIdentifierList* identifierList;
131         };
132         glslang::TArraySizes* typeParameters;
133     } interm;
134 }
135
136 %{
137
138 /* windows only pragma */
139 #ifdef _MSC_VER
140     #pragma warning(disable : 4065)
141     #pragma warning(disable : 4127)
142     #pragma warning(disable : 4244)
143 #endif
144
145 #define parseContext (*pParseContext)
146 #define yyerror(context, msg) context->parserError(msg)
147
148 extern int yylex(YYSTYPE*, TParseContext&);
149
150 %}
151
152 %parse-param {glslang::TParseContext* pParseContext}
153 %lex-param {parseContext}
154 %pure-parser  // enable thread safety
155 %expect 1     // One shift reduce conflict because of if | else
156
157 %token <lex> CONST BOOL INT UINT FLOAT
158 %token <lex> BVEC2 BVEC3 BVEC4
159 %token <lex> IVEC2 IVEC3 IVEC4
160 %token <lex> UVEC2 UVEC3 UVEC4
161 %token <lex> VEC2 VEC3 VEC4
162 %token <lex> MAT2 MAT3 MAT4
163 %token <lex> MAT2X2 MAT2X3 MAT2X4
164 %token <lex> MAT3X2 MAT3X3 MAT3X4
165 %token <lex> MAT4X2 MAT4X3 MAT4X4
166
167 // combined image/sampler
168 %token <lex> SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW
169 %token <lex> SAMPLERCUBESHADOW SAMPLER2DARRAY
170 %token <lex> SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
171 %token <lex> ISAMPLER2DARRAY USAMPLER2D USAMPLER3D
172 %token <lex> USAMPLERCUBE USAMPLER2DARRAY
173
174 // separate image/sampler
175 %token <lex> SAMPLER SAMPLERSHADOW
176 %token <lex>  TEXTURE2D  TEXTURE3D  TEXTURECUBE  TEXTURE2DARRAY
177 %token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY
178 %token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY
179
180 GLSLANG_WEB_EXCLUDE_ON
181
182 %token <lex> ATTRIBUTE VARYING
183 %token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T
184 %token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T
185 %token <lex> I64VEC2 I64VEC3 I64VEC4
186 %token <lex> U64VEC2 U64VEC3 U64VEC4
187 %token <lex> I32VEC2 I32VEC3 I32VEC4
188 %token <lex> U32VEC2 U32VEC3 U32VEC4
189 %token <lex> I16VEC2 I16VEC3 I16VEC4
190 %token <lex> U16VEC2 U16VEC3 U16VEC4
191 %token <lex> I8VEC2  I8VEC3  I8VEC4
192 %token <lex> U8VEC2  U8VEC3  U8VEC4
193 %token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
194 %token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
195 %token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4
196 %token <lex> F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4
197 %token <lex> DMAT2X2 DMAT2X3 DMAT2X4
198 %token <lex> DMAT3X2 DMAT3X3 DMAT3X4
199 %token <lex> DMAT4X2 DMAT4X3 DMAT4X4
200 %token <lex> F16MAT2X2 F16MAT2X3 F16MAT2X4
201 %token <lex> F16MAT3X2 F16MAT3X3 F16MAT3X4
202 %token <lex> F16MAT4X2 F16MAT4X3 F16MAT4X4
203 %token <lex> F32MAT2X2 F32MAT2X3 F32MAT2X4
204 %token <lex> F32MAT3X2 F32MAT3X3 F32MAT3X4
205 %token <lex> F32MAT4X2 F32MAT4X3 F32MAT4X4
206 %token <lex> F64MAT2X2 F64MAT2X3 F64MAT2X4
207 %token <lex> F64MAT3X2 F64MAT3X3 F64MAT3X4
208 %token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
209 %token <lex> ATOMIC_UINT
210 %token <lex> ACCSTRUCTNV
211 %token <lex> ACCSTRUCTEXT
212 %token <lex> RAYQUERYEXT
213 %token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
214
215 // combined image/sampler
216 %token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
217 %token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
218 %token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
219 %token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT
220 %token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER
221 %token <lex> SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS
222 %token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY
223 %token <lex> SAMPLEREXTERNALOES
224 %token <lex> SAMPLEREXTERNAL2DY2YEXT
225 %token <lex> ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY 
226 %token <lex> F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE
227 %token <lex> F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY
228 %token <lex> F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY
229 %token <lex> F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW
230 %token <lex> F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW
231
232 // images
233 %token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D
234 %token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D
235 %token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT
236 %token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE
237 %token <lex> IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER
238 %token <lex> IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY
239 %token <lex> IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY
240 %token <lex> IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY
241 %token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS
242 %token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY
243
244 %token <lex> F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT
245 %token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
246 %token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
247
248 %token <lex> I64IMAGE1D U64IMAGE1D
249 %token <lex> I64IMAGE2D U64IMAGE2D
250 %token <lex> I64IMAGE3D U64IMAGE3D
251 %token <lex> I64IMAGE2DRECT U64IMAGE2DRECT
252 %token <lex> I64IMAGECUBE U64IMAGECUBE
253 %token <lex> I64IMAGEBUFFER U64IMAGEBUFFER
254 %token <lex> I64IMAGE1DARRAY U64IMAGE1DARRAY
255 %token <lex> I64IMAGE2DARRAY U64IMAGE2DARRAY
256 %token <lex> I64IMAGECUBEARRAY U64IMAGECUBEARRAY
257 %token <lex> I64IMAGE2DMS U64IMAGE2DMS
258 %token <lex> I64IMAGE2DMSARRAY U64IMAGE2DMSARRAY
259
260 // texture without sampler
261 %token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
262 %token <lex> TEXTURE1D ITEXTURE1D UTEXTURE1D
263 %token <lex> TEXTURE1DARRAY ITEXTURE1DARRAY UTEXTURE1DARRAY
264 %token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT
265 %token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER
266 %token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
267 %token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
268
269 %token <lex> F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE
270 %token <lex> F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY
271 %token <lex> F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY
272
273 // input attachments
274 %token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS
275 %token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS
276
277 // spirv intrinsics
278 %token <lex> SPIRV_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID
279 %token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING
280 %token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL
281
282 GLSLANG_WEB_EXCLUDE_OFF
283
284 %token <lex> LEFT_OP RIGHT_OP
285 %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
286 %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
287 %token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
288 %token <lex> SUB_ASSIGN
289 %token <lex> STRING_LITERAL
290
291 %token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
292 %token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
293 %token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
294
295 %token <lex> INVARIANT
296 %token <lex> HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
297 %token <lex> PACKED RESOURCE SUPERP
298
299 %token <lex> FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
300 %token <lex> IDENTIFIER TYPE_NAME
301 %token <lex> CENTROID IN OUT INOUT
302 %token <lex> STRUCT VOID WHILE
303 %token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
304 %token <lex> TERMINATE_INVOCATION
305 %token <lex> TERMINATE_RAY IGNORE_INTERSECTION
306 %token <lex> UNIFORM SHARED BUFFER
307 %token <lex> FLAT SMOOTH LAYOUT
308
309 GLSLANG_WEB_EXCLUDE_ON
310 %token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT
311 %token <lex> INT64CONSTANT UINT64CONSTANT
312 %token <lex> SUBROUTINE DEMOTE
313 %token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
314 %token <lex> PAYLOADEXT PAYLOADINEXT HITATTREXT CALLDATAEXT CALLDATAINEXT
315 %token <lex> PATCH SAMPLE NONUNIFORM
316 %token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
317 %token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT
318 %token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT
319 %token <lex> PRECISE
320 GLSLANG_WEB_EXCLUDE_OFF
321
322 %type <interm> assignment_operator unary_operator
323 %type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
324 %type <interm.intermTypedNode> expression integer_expression assignment_expression
325 %type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
326 %type <interm.intermTypedNode> relational_expression equality_expression
327 %type <interm.intermTypedNode> conditional_expression constant_expression
328 %type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
329 %type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
330 %type <interm.intermTypedNode> function_call initializer condition conditionopt
331
332 %type <interm.intermNode> translation_unit function_definition
333 %type <interm.intermNode> statement simple_statement
334 %type <interm.intermNode> statement_list switch_statement_list compound_statement
335 %type <interm.intermNode> declaration_statement selection_statement selection_statement_nonattributed expression_statement
336 %type <interm.intermNode> switch_statement switch_statement_nonattributed case_label
337 %type <interm.intermNode> declaration external_declaration
338 %type <interm.intermNode> for_init_statement compound_statement_no_new_scope
339 %type <interm.nodePair> selection_rest_statement for_rest_statement
340 %type <interm.intermNode> iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped
341 %type <interm> single_declaration init_declarator_list
342
343 %type <interm> parameter_declaration parameter_declarator parameter_type_specifier
344
345 %type <interm> array_specifier
346 %type <interm.type> invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier
347 %type <interm.type> layout_qualifier layout_qualifier_id_list layout_qualifier_id
348
349 %type <interm.typeParameters> type_parameter_specifier
350 %type <interm.typeParameters> type_parameter_specifier_opt
351 %type <interm.typeParameters> type_parameter_specifier_list
352
353 %type <interm.type> type_qualifier fully_specified_type type_specifier
354 %type <interm.type> single_type_qualifier
355 %type <interm.type> type_specifier_nonarray
356 %type <interm.type> struct_specifier
357 %type <interm.typeLine> struct_declarator
358 %type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list
359 %type <interm> block_structure
360 %type <interm.function> function_header function_declarator
361 %type <interm.function> function_header_with_parameters
362 %type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
363 %type <interm> function_call_or_method function_identifier function_call_header
364
365 %type <interm.identifierList> identifier_list
366
367 GLSLANG_WEB_EXCLUDE_ON
368 %type <interm.type> precise_qualifier non_uniform_qualifier
369 %type <interm.typeList> type_name_list
370 %type <interm.attributes> attribute attribute_list single_attribute
371 %type <interm.intermNode> demote_statement
372 %type <interm.intermTypedNode> initializer_list
373 %type <interm.spirvReq> spirv_requirements_list spirv_requirements_parameter
374 %type <interm.intermNode> spirv_extension_list spirv_capability_list
375 %type <interm.intermNode> spirv_execution_mode_qualifier
376 %type <interm.intermNode> spirv_execution_mode_parameter_list spirv_execution_mode_parameter spirv_execution_mode_id_parameter_list
377 %type <interm.type> spirv_storage_class_qualifier
378 %type <interm.type> spirv_decorate_qualifier
379 %type <interm.intermNode> spirv_decorate_parameter_list spirv_decorate_parameter
380 %type <interm.intermNode> spirv_decorate_id_parameter_list
381 %type <interm.intermNode> spirv_decorate_string_parameter_list
382 %type <interm.type> spirv_type_specifier
383 %type <interm.spirvTypeParams> spirv_type_parameter_list spirv_type_parameter
384 %type <interm.spirvInst> spirv_instruction_qualifier
385 %type <interm.spirvInst> spirv_instruction_qualifier_list spirv_instruction_qualifier_id
386 GLSLANG_WEB_EXCLUDE_OFF
387
388 %start translation_unit
389 %%
390
391 variable_identifier
392     : IDENTIFIER {
393         $$ = parseContext.handleVariable($1.loc, $1.symbol, $1.string);
394     }
395     ;
396
397 primary_expression
398     : variable_identifier {
399         $$ = $1;
400     }
401     | LEFT_PAREN expression RIGHT_PAREN {
402         $$ = $2;
403         if ($$->getAsConstantUnion())
404             $$->getAsConstantUnion()->setExpression();
405     }
406     | FLOATCONSTANT {
407         $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
408     }
409     | INTCONSTANT {
410         $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
411     }
412     | UINTCONSTANT {
413         parseContext.fullIntegerCheck($1.loc, "unsigned literal");
414         $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
415     }
416     | BOOLCONSTANT {
417         $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
418     }
419 GLSLANG_WEB_EXCLUDE_ON
420     | STRING_LITERAL {
421         $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true);
422     }
423     | INT32CONSTANT {
424         parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
425         $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
426     }
427     | UINT32CONSTANT {
428         parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
429         $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
430     }
431     | INT64CONSTANT {
432         parseContext.int64Check($1.loc, "64-bit integer literal");
433         $$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true);
434     }
435     | UINT64CONSTANT {
436         parseContext.int64Check($1.loc, "64-bit unsigned integer literal");
437         $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true);
438     }
439     | INT16CONSTANT {
440         parseContext.explicitInt16Check($1.loc, "16-bit integer literal");
441         $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true);
442     }
443     | UINT16CONSTANT {
444         parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal");
445         $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
446     }
447     | DOUBLECONSTANT {
448         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double literal");
449         if (! parseContext.symbolTable.atBuiltInLevel())
450             parseContext.doubleCheck($1.loc, "double literal");
451         $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
452     }
453     | FLOAT16CONSTANT {
454         parseContext.float16Check($1.loc, "half float literal");
455         $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true);
456     }
457 GLSLANG_WEB_EXCLUDE_OFF
458     ;
459
460 postfix_expression
461     : primary_expression {
462         $$ = $1;
463     }
464     | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
465         $$ = parseContext.handleBracketDereference($2.loc, $1, $3);
466     }
467     | function_call {
468         $$ = $1;
469     }
470     | postfix_expression DOT IDENTIFIER {
471         $$ = parseContext.handleDotDereference($3.loc, $1, *$3.string);
472     }
473     | postfix_expression INC_OP {
474         parseContext.variableCheck($1);
475         parseContext.lValueErrorCheck($2.loc, "++", $1);
476         $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1);
477     }
478     | postfix_expression DEC_OP {
479         parseContext.variableCheck($1);
480         parseContext.lValueErrorCheck($2.loc, "--", $1);
481         $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1);
482     }
483     ;
484
485 integer_expression
486     : expression {
487         parseContext.integerCheck($1, "[]");
488         $$ = $1;
489     }
490     ;
491
492 function_call
493     : function_call_or_method {
494         $$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode);
495         delete $1.function;
496     }
497     ;
498
499 function_call_or_method
500     : function_call_generic {
501         $$ = $1;
502     }
503     ;
504
505 function_call_generic
506     : function_call_header_with_parameters RIGHT_PAREN {
507         $$ = $1;
508         $$.loc = $2.loc;
509     }
510     | function_call_header_no_parameters RIGHT_PAREN {
511         $$ = $1;
512         $$.loc = $2.loc;
513     }
514     ;
515
516 function_call_header_no_parameters
517     : function_call_header VOID {
518         $$ = $1;
519     }
520     | function_call_header {
521         $$ = $1;
522     }
523     ;
524
525 function_call_header_with_parameters
526     : function_call_header assignment_expression {
527         TParameter param = { 0, new TType };
528         param.type->shallowCopy($2->getType());
529         $1.function->addParameter(param);
530         $$.function = $1.function;
531         $$.intermNode = $2;
532     }
533     | function_call_header_with_parameters COMMA assignment_expression {
534         TParameter param = { 0, new TType };
535         param.type->shallowCopy($3->getType());
536         $1.function->addParameter(param);
537         $$.function = $1.function;
538         $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc);
539     }
540     ;
541
542 function_call_header
543     : function_identifier LEFT_PAREN {
544         $$ = $1;
545     }
546     ;
547
548 // Grammar Note:  Constructors look like functions, but are recognized as types.
549
550 function_identifier
551     : type_specifier {
552         // Constructor
553         $$.intermNode = 0;
554         $$.function = parseContext.handleConstructorCall($1.loc, $1);
555     }
556     | postfix_expression {
557         //
558         // Should be a method or subroutine call, but we haven't recognized the arguments yet.
559         //
560         $$.function = 0;
561         $$.intermNode = 0;
562
563         TIntermMethod* method = $1->getAsMethodNode();
564         if (method) {
565             $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength);
566             $$.intermNode = method->getObject();
567         } else {
568             TIntermSymbol* symbol = $1->getAsSymbolNode();
569             if (symbol) {
570                 parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName());
571                 TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid));
572                 $$.function = function;
573             } else
574                 parseContext.error($1->getLoc(), "function call, method, or subroutine call expected", "", "");
575         }
576
577         if ($$.function == 0) {
578             // error recover
579             TString* empty = NewPoolTString("");
580             $$.function = new TFunction(empty, TType(EbtVoid), EOpNull);
581         }
582     }
583 GLSLANG_WEB_EXCLUDE_ON
584     | non_uniform_qualifier {
585         // Constructor
586         $$.intermNode = 0;
587         $$.function = parseContext.handleConstructorCall($1.loc, $1);
588     }
589 GLSLANG_WEB_EXCLUDE_OFF
590     ;
591
592 unary_expression
593     : postfix_expression {
594         parseContext.variableCheck($1);
595         $$ = $1;
596         if (TIntermMethod* method = $1->getAsMethodNode())
597             parseContext.error($1->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), "");
598     }
599     | INC_OP unary_expression {
600         parseContext.lValueErrorCheck($1.loc, "++", $2);
601         $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2);
602     }
603     | DEC_OP unary_expression {
604         parseContext.lValueErrorCheck($1.loc, "--", $2);
605         $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2);
606     }
607     | unary_operator unary_expression {
608         if ($1.op != EOpNull) {
609             char errorOp[2] = {0, 0};
610             switch($1.op) {
611             case EOpNegative:   errorOp[0] = '-'; break;
612             case EOpLogicalNot: errorOp[0] = '!'; break;
613             case EOpBitwiseNot: errorOp[0] = '~'; break;
614             default: break; // some compilers want this
615             }
616             $$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2);
617         } else {
618             $$ = $2;
619             if ($$->getAsConstantUnion())
620                 $$->getAsConstantUnion()->setExpression();
621         }
622     }
623     ;
624 // Grammar Note:  No traditional style type casts.
625
626 unary_operator
627     : PLUS  { $$.loc = $1.loc; $$.op = EOpNull; }
628     | DASH  { $$.loc = $1.loc; $$.op = EOpNegative; }
629     | BANG  { $$.loc = $1.loc; $$.op = EOpLogicalNot; }
630     | TILDE { $$.loc = $1.loc; $$.op = EOpBitwiseNot;
631               parseContext.fullIntegerCheck($1.loc, "bitwise not"); }
632     ;
633 // Grammar Note:  No '*' or '&' unary ops.  Pointers are not supported.
634
635 multiplicative_expression
636     : unary_expression { $$ = $1; }
637     | multiplicative_expression STAR unary_expression {
638         $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3);
639         if ($$ == 0)
640             $$ = $1;
641     }
642     | multiplicative_expression SLASH unary_expression {
643         $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3);
644         if ($$ == 0)
645             $$ = $1;
646     }
647     | multiplicative_expression PERCENT unary_expression {
648         parseContext.fullIntegerCheck($2.loc, "%");
649         $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3);
650         if ($$ == 0)
651             $$ = $1;
652     }
653     ;
654
655 additive_expression
656     : multiplicative_expression { $$ = $1; }
657     | additive_expression PLUS multiplicative_expression {
658         $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3);
659         if ($$ == 0)
660             $$ = $1;
661     }
662     | additive_expression DASH multiplicative_expression {
663         $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3);
664         if ($$ == 0)
665             $$ = $1;
666     }
667     ;
668
669 shift_expression
670     : additive_expression { $$ = $1; }
671     | shift_expression LEFT_OP additive_expression {
672         parseContext.fullIntegerCheck($2.loc, "bit shift left");
673         $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3);
674         if ($$ == 0)
675             $$ = $1;
676     }
677     | shift_expression RIGHT_OP additive_expression {
678         parseContext.fullIntegerCheck($2.loc, "bit shift right");
679         $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3);
680         if ($$ == 0)
681             $$ = $1;
682     }
683     ;
684
685 relational_expression
686     : shift_expression { $$ = $1; }
687     | relational_expression LEFT_ANGLE shift_expression {
688         $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3);
689         if ($$ == 0)
690             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
691     }
692     | relational_expression RIGHT_ANGLE shift_expression  {
693         $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3);
694         if ($$ == 0)
695             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
696     }
697     | relational_expression LE_OP shift_expression  {
698         $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3);
699         if ($$ == 0)
700             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
701     }
702     | relational_expression GE_OP shift_expression  {
703         $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3);
704         if ($$ == 0)
705             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
706     }
707     ;
708
709 equality_expression
710     : relational_expression { $$ = $1; }
711     | equality_expression EQ_OP relational_expression  {
712         parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
713         parseContext.opaqueCheck($2.loc, $1->getType(), "==");
714         parseContext.specializationCheck($2.loc, $1->getType(), "==");
715         parseContext.referenceCheck($2.loc, $1->getType(), "==");
716         $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3);
717         if ($$ == 0)
718             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
719     }
720     | equality_expression NE_OP relational_expression {
721         parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
722         parseContext.opaqueCheck($2.loc, $1->getType(), "!=");
723         parseContext.specializationCheck($2.loc, $1->getType(), "!=");
724         parseContext.referenceCheck($2.loc, $1->getType(), "!=");
725         $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3);
726         if ($$ == 0)
727             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
728     }
729     ;
730
731 and_expression
732     : equality_expression { $$ = $1; }
733     | and_expression AMPERSAND equality_expression {
734         parseContext.fullIntegerCheck($2.loc, "bitwise and");
735         $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3);
736         if ($$ == 0)
737             $$ = $1;
738     }
739     ;
740
741 exclusive_or_expression
742     : and_expression { $$ = $1; }
743     | exclusive_or_expression CARET and_expression {
744         parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or");
745         $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3);
746         if ($$ == 0)
747             $$ = $1;
748     }
749     ;
750
751 inclusive_or_expression
752     : exclusive_or_expression { $$ = $1; }
753     | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
754         parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or");
755         $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3);
756         if ($$ == 0)
757             $$ = $1;
758     }
759     ;
760
761 logical_and_expression
762     : inclusive_or_expression { $$ = $1; }
763     | logical_and_expression AND_OP inclusive_or_expression {
764         $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3);
765         if ($$ == 0)
766             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
767     }
768     ;
769
770 logical_xor_expression
771     : logical_and_expression { $$ = $1; }
772     | logical_xor_expression XOR_OP logical_and_expression  {
773         $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3);
774         if ($$ == 0)
775             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
776     }
777     ;
778
779 logical_or_expression
780     : logical_xor_expression { $$ = $1; }
781     | logical_or_expression OR_OP logical_xor_expression  {
782         $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3);
783         if ($$ == 0)
784             $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
785     }
786     ;
787
788 conditional_expression
789     : logical_or_expression { $$ = $1; }
790     | logical_or_expression QUESTION {
791         ++parseContext.controlFlowNestingLevel;
792     }
793       expression COLON assignment_expression {
794         --parseContext.controlFlowNestingLevel;
795         parseContext.boolCheck($2.loc, $1);
796         parseContext.rValueErrorCheck($2.loc, "?", $1);
797         parseContext.rValueErrorCheck($5.loc, ":", $4);
798         parseContext.rValueErrorCheck($5.loc, ":", $6);
799         $$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc);
800         if ($$ == 0) {
801             parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $6->getCompleteString(parseContext.intermediate.getEnhancedMsgs()));
802             $$ = $6;
803         }
804     }
805     ;
806
807 assignment_expression
808     : conditional_expression { $$ = $1; }
809     | unary_expression assignment_operator assignment_expression {
810         parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment");
811         parseContext.opaqueCheck($2.loc, $1->getType(), "=");
812         parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "=");
813         parseContext.specializationCheck($2.loc, $1->getType(), "=");
814         parseContext.lValueErrorCheck($2.loc, "assign", $1);
815         parseContext.rValueErrorCheck($2.loc, "assign", $3);
816         $$ = parseContext.addAssign($2.loc, $2.op, $1, $3);
817         if ($$ == 0) {
818             parseContext.assignError($2.loc, "assign", $1->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $3->getCompleteString(parseContext.intermediate.getEnhancedMsgs()));
819             $$ = $1;
820         }
821     }
822     ;
823
824 assignment_operator
825     : EQUAL {
826         $$.loc = $1.loc;
827         $$.op = EOpAssign;
828     }
829     | MUL_ASSIGN {
830         $$.loc = $1.loc;
831         $$.op = EOpMulAssign;
832     }
833     | DIV_ASSIGN {
834         $$.loc = $1.loc;
835         $$.op = EOpDivAssign;
836     }
837     | MOD_ASSIGN {
838         parseContext.fullIntegerCheck($1.loc, "%=");
839         $$.loc = $1.loc;
840         $$.op = EOpModAssign;
841     }
842     | ADD_ASSIGN {
843         $$.loc = $1.loc;
844         $$.op = EOpAddAssign;
845     }
846     | SUB_ASSIGN {
847         $$.loc = $1.loc;
848         $$.op = EOpSubAssign;
849     }
850     | LEFT_ASSIGN {
851         parseContext.fullIntegerCheck($1.loc, "bit-shift left assign");
852         $$.loc = $1.loc; $$.op = EOpLeftShiftAssign;
853     }
854     | RIGHT_ASSIGN {
855         parseContext.fullIntegerCheck($1.loc, "bit-shift right assign");
856         $$.loc = $1.loc; $$.op = EOpRightShiftAssign;
857     }
858     | AND_ASSIGN {
859         parseContext.fullIntegerCheck($1.loc, "bitwise-and assign");
860         $$.loc = $1.loc; $$.op = EOpAndAssign;
861     }
862     | XOR_ASSIGN {
863         parseContext.fullIntegerCheck($1.loc, "bitwise-xor assign");
864         $$.loc = $1.loc; $$.op = EOpExclusiveOrAssign;
865     }
866     | OR_ASSIGN {
867         parseContext.fullIntegerCheck($1.loc, "bitwise-or assign");
868         $$.loc = $1.loc; $$.op = EOpInclusiveOrAssign;
869     }
870     ;
871
872 expression
873     : assignment_expression {
874         $$ = $1;
875     }
876     | expression COMMA assignment_expression {
877         parseContext.samplerConstructorLocationCheck($2.loc, ",", $3);
878         $$ = parseContext.intermediate.addComma($1, $3, $2.loc);
879         if ($$ == 0) {
880             parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $3->getCompleteString(parseContext.intermediate.getEnhancedMsgs()));
881             $$ = $3;
882         }
883     }
884     ;
885
886 constant_expression
887     : conditional_expression {
888         parseContext.constantValueCheck($1, "");
889         $$ = $1;
890     }
891     ;
892
893 declaration
894     : function_prototype SEMICOLON {
895         parseContext.handleFunctionDeclarator($1.loc, *$1.function, true /* prototype */);
896         $$ = 0;
897         // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
898     }
899 GLSLANG_WEB_EXCLUDE_ON
900     | spirv_instruction_qualifier function_prototype SEMICOLON {
901         parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier");
902         $2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier
903         parseContext.handleFunctionDeclarator($2.loc, *$2.function, true /* prototype */);
904         $$ = 0;
905         // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
906     }
907     | spirv_execution_mode_qualifier SEMICOLON {
908         parseContext.globalCheck($2.loc, "SPIR-V execution mode qualifier");
909         parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier");
910         $$ = 0;
911     }
912 GLSLANG_WEB_EXCLUDE_OFF
913     | init_declarator_list SEMICOLON {
914         if ($1.intermNode && $1.intermNode->getAsAggregate())
915             $1.intermNode->getAsAggregate()->setOperator(EOpSequence);
916         $$ = $1.intermNode;
917     }
918     | PRECISION precision_qualifier type_specifier SEMICOLON {
919         parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement");
920         // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope
921         parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]);
922         parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision);
923         $$ = 0;
924     }
925     | block_structure SEMICOLON {
926         parseContext.declareBlock($1.loc, *$1.typeList);
927         $$ = 0;
928     }
929     | block_structure IDENTIFIER SEMICOLON {
930         parseContext.declareBlock($1.loc, *$1.typeList, $2.string);
931         $$ = 0;
932     }
933     | block_structure IDENTIFIER array_specifier SEMICOLON {
934         parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes);
935         $$ = 0;
936     }
937     | type_qualifier SEMICOLON {
938         parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
939         parseContext.updateStandaloneQualifierDefaults($1.loc, $1);
940         $$ = 0;
941     }
942     | type_qualifier IDENTIFIER SEMICOLON {
943         parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
944         parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string);
945         $$ = 0;
946     }
947     | type_qualifier IDENTIFIER identifier_list SEMICOLON {
948         parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
949         $3->push_back($2.string);
950         parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3);
951         $$ = 0;
952     }
953     ;
954
955 block_structure
956     : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
957         --parseContext.blockNestingLevel;
958         parseContext.blockName = $2.string;
959         parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
960         parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
961         parseContext.currentBlockQualifier = $1.qualifier;
962         $$.loc = $1.loc;
963         $$.typeList = $5;
964     }
965
966 identifier_list
967     : COMMA IDENTIFIER {
968         $$ = new TIdentifierList;
969         $$->push_back($2.string);
970     }
971     | identifier_list COMMA IDENTIFIER {
972         $$ = $1;
973         $$->push_back($3.string);
974     }
975     ;
976
977 function_prototype
978     : function_declarator RIGHT_PAREN  {
979         $$.function = $1;
980         $$.loc = $2.loc;
981     }
982     | function_declarator RIGHT_PAREN attribute {
983         $$.function = $1;
984         $$.loc = $2.loc;
985         parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
986         parseContext.handleFunctionAttributes($2.loc, *$3);
987     }
988     | attribute function_declarator RIGHT_PAREN {
989         $$.function = $2;
990         $$.loc = $3.loc;
991         parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
992         parseContext.handleFunctionAttributes($3.loc, *$1);
993     }
994     | attribute function_declarator RIGHT_PAREN attribute {
995         $$.function = $2;
996         $$.loc = $3.loc;
997         parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
998         parseContext.handleFunctionAttributes($3.loc, *$1);
999         parseContext.handleFunctionAttributes($3.loc, *$4);
1000     }
1001     ;
1002
1003 function_declarator
1004     : function_header {
1005         $$ = $1;
1006     }
1007     | function_header_with_parameters {
1008         $$ = $1;
1009     }
1010     ;
1011
1012
1013 function_header_with_parameters
1014     : function_header parameter_declaration {
1015         // Add the parameter
1016         $$ = $1;
1017         if ($2.param.type->getBasicType() != EbtVoid)
1018             $1->addParameter($2.param);
1019         else
1020             delete $2.param.type;
1021     }
1022     | function_header_with_parameters COMMA parameter_declaration {
1023         //
1024         // Only first parameter of one-parameter functions can be void
1025         // The check for named parameters not being void is done in parameter_declarator
1026         //
1027         if ($3.param.type->getBasicType() == EbtVoid) {
1028             //
1029             // This parameter > first is void
1030             //
1031             parseContext.error($2.loc, "cannot be an argument type except for '(void)'", "void", "");
1032             delete $3.param.type;
1033         } else {
1034             // Add the parameter
1035             $$ = $1;
1036             $1->addParameter($3.param);
1037         }
1038     }
1039     ;
1040
1041 function_header
1042     : fully_specified_type IDENTIFIER LEFT_PAREN {
1043         if ($1.qualifier.storage != EvqGlobal && $1.qualifier.storage != EvqTemporary) {
1044             parseContext.error($2.loc, "no qualifiers allowed for function return",
1045                                GetStorageQualifierString($1.qualifier.storage), "");
1046         }
1047         if ($1.arraySizes)
1048             parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1049
1050         // Add the function as a prototype after parsing it (we do not support recursion)
1051         TFunction *function;
1052         TType type($1);
1053
1054         // Potentially rename shader entry point function.  No-op most of the time.
1055         parseContext.renameShaderFunction($2.string);
1056
1057         // Make the function
1058         function = new TFunction($2.string, type);
1059         $$ = function;
1060     }
1061     ;
1062
1063 parameter_declarator
1064     // Type + name
1065     : type_specifier IDENTIFIER {
1066         if ($1.arraySizes) {
1067             parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1068             parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1069             parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1070         }
1071         if ($1.basicType == EbtVoid) {
1072             parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), "");
1073         }
1074         parseContext.reservedErrorCheck($2.loc, *$2.string);
1075
1076         TParameter param = {$2.string, new TType($1)};
1077         $$.loc = $2.loc;
1078         $$.param = param;
1079     }
1080     | type_specifier IDENTIFIER array_specifier {
1081         if ($1.arraySizes) {
1082             parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1083             parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1084             parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1085         }
1086         TType* type = new TType($1);
1087         type->transferArraySizes($3.arraySizes);
1088         type->copyArrayInnerSizes($1.arraySizes);
1089
1090         parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes());
1091         parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes);
1092         parseContext.reservedErrorCheck($2.loc, *$2.string);
1093
1094         TParameter param = { $2.string, type };
1095
1096         $$.loc = $2.loc;
1097         $$.param = param;
1098     }
1099     ;
1100
1101 parameter_declaration
1102     //
1103     // With name
1104     //
1105     : type_qualifier parameter_declarator {
1106         $$ = $2;
1107         if ($1.qualifier.precision != EpqNone)
1108             $$.param.type->getQualifier().precision = $1.qualifier.precision;
1109         parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1110
1111         parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
1112         parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
1113         parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
1114
1115     }
1116     | parameter_declarator {
1117         $$ = $1;
1118
1119         parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
1120         parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
1121         parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1122     }
1123     //
1124     // Without name
1125     //
1126     | type_qualifier parameter_type_specifier {
1127         $$ = $2;
1128         if ($1.qualifier.precision != EpqNone)
1129             $$.param.type->getQualifier().precision = $1.qualifier.precision;
1130         parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1131
1132         parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
1133         parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
1134         parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
1135     }
1136     | parameter_type_specifier {
1137         $$ = $1;
1138
1139         parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
1140         parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
1141         parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1142     }
1143     ;
1144
1145 parameter_type_specifier
1146     : type_specifier {
1147         TParameter param = { 0, new TType($1) };
1148         $$.param = param;
1149         if ($1.arraySizes)
1150             parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1151     }
1152     ;
1153
1154 init_declarator_list
1155     : single_declaration {
1156         $$ = $1;
1157     }
1158     | init_declarator_list COMMA IDENTIFIER {
1159         $$ = $1;
1160         parseContext.declareVariable($3.loc, *$3.string, $1.type);
1161     }
1162     | init_declarator_list COMMA IDENTIFIER array_specifier {
1163         $$ = $1;
1164         parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes);
1165     }
1166     | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer {
1167         $$.type = $1.type;
1168         TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6);
1169         $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc);
1170     }
1171     | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
1172         $$.type = $1.type;
1173         TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5);
1174         $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc);
1175     }
1176     ;
1177
1178 single_declaration
1179     : fully_specified_type {
1180         $$.type = $1;
1181         $$.intermNode = 0;
1182 GLSLANG_WEB_EXCLUDE_ON
1183         parseContext.declareTypeDefaults($$.loc, $$.type);
1184 GLSLANG_WEB_EXCLUDE_OFF
1185     }
1186     | fully_specified_type IDENTIFIER {
1187         $$.type = $1;
1188         $$.intermNode = 0;
1189         parseContext.declareVariable($2.loc, *$2.string, $1);
1190     }
1191     | fully_specified_type IDENTIFIER array_specifier {
1192         $$.type = $1;
1193         $$.intermNode = 0;
1194         parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes);
1195     }
1196     | fully_specified_type IDENTIFIER array_specifier EQUAL initializer {
1197         $$.type = $1;
1198         TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5);
1199         $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc);
1200     }
1201     | fully_specified_type IDENTIFIER EQUAL initializer {
1202         $$.type = $1;
1203         TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
1204         $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc);
1205     }
1206
1207 // Grammar Note:  No 'enum', or 'typedef'.
1208
1209 fully_specified_type
1210     : type_specifier {
1211         $$ = $1;
1212
1213         parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$);
1214         if ($1.arraySizes) {
1215             parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1216             parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1217         }
1218         parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
1219     }
1220     | type_qualifier type_specifier  {
1221         parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
1222         parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2);
1223
1224         if ($2.arraySizes) {
1225             parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1226             parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
1227         }
1228
1229         if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier))
1230             $2.arraySizes = nullptr;
1231
1232         parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers);
1233         $2.shaderQualifiers.merge($1.shaderQualifiers);
1234         parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
1235         parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
1236
1237         $$ = $2;
1238
1239         if (! $$.qualifier.isInterpolation() &&
1240             ((parseContext.language == EShLangVertex   && $$.qualifier.storage == EvqVaryingOut) ||
1241              (parseContext.language == EShLangFragment && $$.qualifier.storage == EvqVaryingIn)))
1242             $$.qualifier.smooth = true;
1243     }
1244     ;
1245
1246 invariant_qualifier
1247     : INVARIANT {
1248         parseContext.globalCheck($1.loc, "invariant");
1249         parseContext.profileRequires($$.loc, ENoProfile, 120, 0, "invariant");
1250         $$.init($1.loc);
1251         $$.qualifier.invariant = true;
1252     }
1253     ;
1254
1255 interpolation_qualifier
1256     : SMOOTH {
1257         parseContext.globalCheck($1.loc, "smooth");
1258         parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "smooth");
1259         parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "smooth");
1260         $$.init($1.loc);
1261         $$.qualifier.smooth = true;
1262     }
1263     | FLAT {
1264         parseContext.globalCheck($1.loc, "flat");
1265         parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "flat");
1266         parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "flat");
1267         $$.init($1.loc);
1268         $$.qualifier.flat = true;
1269     }
1270 GLSLANG_WEB_EXCLUDE_ON
1271     | NOPERSPECTIVE {
1272         parseContext.globalCheck($1.loc, "noperspective");
1273         parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective");
1274         parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective");
1275         $$.init($1.loc);
1276         $$.qualifier.nopersp = true;
1277     }
1278     | EXPLICITINTERPAMD {
1279         parseContext.globalCheck($1.loc, "__explicitInterpAMD");
1280         parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
1281         parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
1282         $$.init($1.loc);
1283         $$.qualifier.explicitInterp = true;
1284     }
1285     | PERVERTEXNV {
1286         parseContext.globalCheck($1.loc, "pervertexNV");
1287         parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1288         parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1289         parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1290         $$.init($1.loc);
1291         $$.qualifier.pervertexNV = true;
1292     }
1293     | PERVERTEXEXT {
1294         parseContext.globalCheck($1.loc, "pervertexEXT");
1295         parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
1296         parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
1297         parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
1298         $$.init($1.loc);
1299         $$.qualifier.pervertexEXT = true;
1300     }
1301     | PERPRIMITIVENV {
1302         // No need for profile version or extension check. Shader stage already checks both.
1303         parseContext.globalCheck($1.loc, "perprimitiveNV");
1304         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshMask), "perprimitiveNV");
1305         // Fragment shader stage doesn't check for extension. So we explicitly add below extension check.
1306         if (parseContext.language == EShLangFragment)
1307             parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV");
1308         $$.init($1.loc);
1309         $$.qualifier.perPrimitiveNV = true;
1310     }
1311     | PERPRIMITIVEEXT {
1312         // No need for profile version or extension check. Shader stage already checks both.
1313         parseContext.globalCheck($1.loc, "perprimitiveEXT");
1314         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshMask), "perprimitiveEXT");
1315         // Fragment shader stage doesn't check for extension. So we explicitly add below extension check.
1316         if (parseContext.language == EShLangFragment)
1317             parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_mesh_shader, "perprimitiveEXT");
1318         $$.init($1.loc);
1319         $$.qualifier.perPrimitiveNV = true;
1320     }
1321     | PERVIEWNV {
1322         // No need for profile version or extension check. Shader stage already checks both.
1323         parseContext.globalCheck($1.loc, "perviewNV");
1324         parseContext.requireStage($1.loc, EShLangMesh, "perviewNV");
1325         $$.init($1.loc);
1326         $$.qualifier.perViewNV = true;
1327     }
1328     | PERTASKNV {
1329         // No need for profile version or extension check. Shader stage already checks both.
1330         parseContext.globalCheck($1.loc, "taskNV");
1331         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask), "taskNV");
1332         $$.init($1.loc);
1333         $$.qualifier.perTaskNV = true;
1334     }
1335 GLSLANG_WEB_EXCLUDE_OFF
1336     ;
1337
1338 layout_qualifier
1339     : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
1340         $$ = $3;
1341     }
1342     ;
1343
1344 layout_qualifier_id_list
1345     : layout_qualifier_id {
1346         $$ = $1;
1347     }
1348     | layout_qualifier_id_list COMMA layout_qualifier_id {
1349         $$ = $1;
1350         $$.shaderQualifiers.merge($3.shaderQualifiers);
1351         parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false);
1352     }
1353
1354 layout_qualifier_id
1355     : IDENTIFIER {
1356         $$.init($1.loc);
1357         parseContext.setLayoutQualifier($1.loc, $$, *$1.string);
1358     }
1359     | IDENTIFIER EQUAL constant_expression {
1360         $$.init($1.loc);
1361         parseContext.setLayoutQualifier($1.loc, $$, *$1.string, $3);
1362     }
1363     | SHARED { // because "shared" is both an identifier and a keyword
1364         $$.init($1.loc);
1365         TString strShared("shared");
1366         parseContext.setLayoutQualifier($1.loc, $$, strShared);
1367     }
1368     ;
1369
1370 GLSLANG_WEB_EXCLUDE_ON
1371 precise_qualifier
1372     : PRECISE {
1373         parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise");
1374         parseContext.profileRequires($1.loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise");
1375         $$.init($1.loc);
1376         $$.qualifier.noContraction = true;
1377     }
1378     ;
1379 GLSLANG_WEB_EXCLUDE_OFF
1380
1381 type_qualifier
1382     : single_type_qualifier {
1383         $$ = $1;
1384     }
1385     | type_qualifier single_type_qualifier {
1386         $$ = $1;
1387         if ($$.basicType == EbtVoid)
1388             $$.basicType = $2.basicType;
1389
1390         $$.shaderQualifiers.merge($2.shaderQualifiers);
1391         parseContext.mergeQualifiers($$.loc, $$.qualifier, $2.qualifier, false);
1392     }
1393     ;
1394
1395 single_type_qualifier
1396     : storage_qualifier {
1397         $$ = $1;
1398     }
1399     | layout_qualifier {
1400         $$ = $1;
1401     }
1402     | precision_qualifier {
1403         parseContext.checkPrecisionQualifier($1.loc, $1.qualifier.precision);
1404         $$ = $1;
1405     }
1406     | interpolation_qualifier {
1407         // allow inheritance of storage qualifier from block declaration
1408         $$ = $1;
1409     }
1410     | invariant_qualifier {
1411         // allow inheritance of storage qualifier from block declaration
1412         $$ = $1;
1413     }
1414 GLSLANG_WEB_EXCLUDE_ON
1415     | precise_qualifier {
1416         // allow inheritance of storage qualifier from block declaration
1417         $$ = $1;
1418     }
1419     | non_uniform_qualifier {
1420         $$ = $1;
1421     }
1422     | spirv_storage_class_qualifier {
1423         parseContext.globalCheck($1.loc, "spirv_storage_class");
1424         parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V storage class qualifier");
1425         $$ = $1;
1426     }
1427     | spirv_decorate_qualifier {
1428         parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V decorate qualifier");
1429         $$ = $1;
1430     }
1431     | SPIRV_BY_REFERENCE {
1432         parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_reference");
1433         $$.init($1.loc);
1434         $$.qualifier.setSpirvByReference();
1435     }
1436     | SPIRV_LITERAL {
1437         parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_literal");
1438         $$.init($1.loc);
1439         $$.qualifier.setSpirvLiteral();
1440     }
1441 GLSLANG_WEB_EXCLUDE_OFF
1442     ;
1443
1444 storage_qualifier
1445     : CONST {
1446         $$.init($1.loc);
1447         $$.qualifier.storage = EvqConst;  // will later turn into EvqConstReadOnly, if the initializer is not constant
1448     }
1449     | INOUT {
1450         parseContext.globalCheck($1.loc, "inout");
1451         $$.init($1.loc);
1452         $$.qualifier.storage = EvqInOut;
1453     }
1454     | IN {
1455         parseContext.globalCheck($1.loc, "in");
1456         $$.init($1.loc);
1457         // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later
1458         $$.qualifier.storage = EvqIn;
1459     }
1460     | OUT {
1461         parseContext.globalCheck($1.loc, "out");
1462         $$.init($1.loc);
1463         // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later
1464         $$.qualifier.storage = EvqOut;
1465     }
1466     | CENTROID {
1467         parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid");
1468         parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid");
1469         parseContext.globalCheck($1.loc, "centroid");
1470         $$.init($1.loc);
1471         $$.qualifier.centroid = true;
1472     }
1473     | UNIFORM {
1474         parseContext.globalCheck($1.loc, "uniform");
1475         $$.init($1.loc);
1476         $$.qualifier.storage = EvqUniform;
1477     }
1478     | SHARED {
1479         parseContext.globalCheck($1.loc, "shared");
1480         parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
1481         parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
1482         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshMask | EShLangTaskMask), "shared");
1483         $$.init($1.loc);
1484         $$.qualifier.storage = EvqShared;
1485     }
1486     | BUFFER {
1487         parseContext.globalCheck($1.loc, "buffer");
1488         $$.init($1.loc);
1489         $$.qualifier.storage = EvqBuffer;
1490     }
1491 GLSLANG_WEB_EXCLUDE_ON
1492     | ATTRIBUTE {
1493         parseContext.requireStage($1.loc, EShLangVertex, "attribute");
1494         parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
1495         parseContext.checkDeprecated($1.loc, ENoProfile, 130, "attribute");
1496         parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "attribute");
1497         parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "attribute");
1498
1499         parseContext.globalCheck($1.loc, "attribute");
1500
1501         $$.init($1.loc);
1502         $$.qualifier.storage = EvqVaryingIn;
1503     }
1504     | VARYING {
1505         parseContext.checkDeprecated($1.loc, ENoProfile, 130, "varying");
1506         parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "varying");
1507         parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "varying");
1508         parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "varying");
1509
1510         parseContext.globalCheck($1.loc, "varying");
1511
1512         $$.init($1.loc);
1513         if (parseContext.language == EShLangVertex)
1514             $$.qualifier.storage = EvqVaryingOut;
1515         else
1516             $$.qualifier.storage = EvqVaryingIn;
1517     }
1518     | PATCH {
1519         parseContext.globalCheck($1.loc, "patch");
1520         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch");
1521         $$.init($1.loc);
1522         $$.qualifier.patch = true;
1523     }
1524     | SAMPLE {
1525         parseContext.globalCheck($1.loc, "sample");
1526         $$.init($1.loc);
1527         $$.qualifier.sample = true;
1528     }
1529     | HITATTRNV {
1530         parseContext.globalCheck($1.loc, "hitAttributeNV");
1531         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask
1532             | EShLangAnyHitMask), "hitAttributeNV");
1533         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV");
1534         $$.init($1.loc);
1535         $$.qualifier.storage = EvqHitAttr;
1536     }
1537     | HITATTREXT {
1538         parseContext.globalCheck($1.loc, "hitAttributeEXT");
1539         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask
1540             | EShLangAnyHitMask), "hitAttributeEXT");
1541         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "hitAttributeNV");
1542         $$.init($1.loc);
1543         $$.qualifier.storage = EvqHitAttr;
1544     }
1545     | PAYLOADNV {
1546         parseContext.globalCheck($1.loc, "rayPayloadNV");
1547         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask |
1548             EShLangAnyHitMask | EShLangMissMask), "rayPayloadNV");
1549         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV");
1550         $$.init($1.loc);
1551         $$.qualifier.storage = EvqPayload;
1552     }
1553     | PAYLOADEXT {
1554         parseContext.globalCheck($1.loc, "rayPayloadEXT");
1555         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask |
1556             EShLangAnyHitMask | EShLangMissMask), "rayPayloadEXT");
1557         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "rayPayloadEXT");
1558         $$.init($1.loc);
1559         $$.qualifier.storage = EvqPayload;
1560     }
1561     | PAYLOADINNV {
1562         parseContext.globalCheck($1.loc, "rayPayloadInNV");
1563         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitMask |
1564             EShLangAnyHitMask | EShLangMissMask), "rayPayloadInNV");
1565         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV");
1566         $$.init($1.loc);
1567         $$.qualifier.storage = EvqPayloadIn;
1568     }
1569     | PAYLOADINEXT {
1570         parseContext.globalCheck($1.loc, "rayPayloadInEXT");
1571         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitMask |
1572             EShLangAnyHitMask | EShLangMissMask), "rayPayloadInEXT");
1573         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "rayPayloadInEXT");
1574         $$.init($1.loc);
1575         $$.qualifier.storage = EvqPayloadIn;
1576     }
1577     | CALLDATANV {
1578         parseContext.globalCheck($1.loc, "callableDataNV");
1579         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask |
1580             EShLangClosestHitMask | EShLangMissMask | EShLangCallableMask), "callableDataNV");
1581         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV");
1582         $$.init($1.loc);
1583         $$.qualifier.storage = EvqCallableData;
1584     }
1585     | CALLDATAEXT {
1586         parseContext.globalCheck($1.loc, "callableDataEXT");
1587         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask |
1588             EShLangClosestHitMask | EShLangMissMask | EShLangCallableMask), "callableDataEXT");
1589         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "callableDataEXT");
1590         $$.init($1.loc);
1591         $$.qualifier.storage = EvqCallableData;
1592     }
1593     | CALLDATAINNV {
1594         parseContext.globalCheck($1.loc, "callableDataInNV");
1595         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInNV");
1596         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV");
1597         $$.init($1.loc);
1598         $$.qualifier.storage = EvqCallableDataIn;
1599     }
1600     | CALLDATAINEXT {
1601         parseContext.globalCheck($1.loc, "callableDataInEXT");
1602         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInEXT");
1603         parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "callableDataInEXT");
1604         $$.init($1.loc);
1605         $$.qualifier.storage = EvqCallableDataIn;
1606     }
1607     | COHERENT {
1608         $$.init($1.loc);
1609         $$.qualifier.coherent = true;
1610     }
1611     | DEVICECOHERENT {
1612         $$.init($1.loc);
1613         parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent");
1614         $$.qualifier.devicecoherent = true;
1615     }
1616     | QUEUEFAMILYCOHERENT {
1617         $$.init($1.loc);
1618         parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent");
1619         $$.qualifier.queuefamilycoherent = true;
1620     }
1621     | WORKGROUPCOHERENT {
1622         $$.init($1.loc);
1623         parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent");
1624         $$.qualifier.workgroupcoherent = true;
1625     }
1626     | SUBGROUPCOHERENT {
1627         $$.init($1.loc);
1628         parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent");
1629         $$.qualifier.subgroupcoherent = true;
1630     }
1631     | NONPRIVATE {
1632         $$.init($1.loc);
1633         parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate");
1634         $$.qualifier.nonprivate = true;
1635     }
1636     | SHADERCALLCOHERENT {
1637         $$.init($1.loc);
1638         parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_ray_tracing, "shadercallcoherent");
1639         $$.qualifier.shadercallcoherent = true;
1640     }
1641     | VOLATILE {
1642         $$.init($1.loc);
1643         $$.qualifier.volatil = true;
1644     }
1645     | RESTRICT {
1646         $$.init($1.loc);
1647         $$.qualifier.restrict = true;
1648     }
1649     | READONLY {
1650         $$.init($1.loc);
1651         $$.qualifier.readonly = true;
1652     }
1653     | WRITEONLY {
1654         $$.init($1.loc);
1655         $$.qualifier.writeonly = true;
1656     }
1657     | SUBROUTINE {
1658         parseContext.spvRemoved($1.loc, "subroutine");
1659         parseContext.globalCheck($1.loc, "subroutine");
1660         parseContext.unimplemented($1.loc, "subroutine");
1661         $$.init($1.loc);
1662     }
1663     | SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN {
1664         parseContext.spvRemoved($1.loc, "subroutine");
1665         parseContext.globalCheck($1.loc, "subroutine");
1666         parseContext.unimplemented($1.loc, "subroutine");
1667         $$.init($1.loc);
1668     }
1669     | TASKPAYLOADWORKGROUPEXT {
1670         // No need for profile version or extension check. Shader stage already checks both.
1671         parseContext.globalCheck($1.loc, "taskPayloadSharedEXT");
1672         parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask), "taskPayloadSharedEXT  ");
1673         $$.init($1.loc);
1674         $$.qualifier.storage = EvqtaskPayloadSharedEXT;
1675     }
1676 GLSLANG_WEB_EXCLUDE_OFF
1677     ;
1678
1679 GLSLANG_WEB_EXCLUDE_ON
1680 non_uniform_qualifier
1681     : NONUNIFORM {
1682         $$.init($1.loc);
1683         $$.qualifier.nonUniform = true;
1684     }
1685     ;
1686
1687 type_name_list
1688     : IDENTIFIER {
1689         // TODO
1690     }
1691     | type_name_list COMMA IDENTIFIER {
1692         // TODO: 4.0 semantics: subroutines
1693         // 1) make sure each identifier is a type declared earlier with SUBROUTINE
1694         // 2) save all of the identifiers for future comparison with the declared function
1695     }
1696     ;
1697 GLSLANG_WEB_EXCLUDE_OFF
1698
1699 type_specifier
1700     : type_specifier_nonarray type_parameter_specifier_opt {
1701         $$ = $1;
1702         $$.qualifier.precision = parseContext.getDefaultPrecision($$);
1703         $$.typeParameters = $2;
1704     }
1705     | type_specifier_nonarray type_parameter_specifier_opt array_specifier {
1706         parseContext.arrayOfArrayVersionCheck($3.loc, $3.arraySizes);
1707         $$ = $1;
1708         $$.qualifier.precision = parseContext.getDefaultPrecision($$);
1709         $$.typeParameters = $2;
1710         $$.arraySizes = $3.arraySizes;
1711     }
1712     ;
1713
1714 array_specifier
1715     : LEFT_BRACKET RIGHT_BRACKET {
1716         $$.loc = $1.loc;
1717         $$.arraySizes = new TArraySizes;
1718         $$.arraySizes->addInnerSize();
1719     }
1720     | LEFT_BRACKET conditional_expression RIGHT_BRACKET {
1721         $$.loc = $1.loc;
1722         $$.arraySizes = new TArraySizes;
1723
1724         TArraySize size;
1725         parseContext.arraySizeCheck($2->getLoc(), $2, size, "array size");
1726         $$.arraySizes->addInnerSize(size);
1727     }
1728     | array_specifier LEFT_BRACKET RIGHT_BRACKET {
1729         $$ = $1;
1730         $$.arraySizes->addInnerSize();
1731     }
1732     | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET {
1733         $$ = $1;
1734
1735         TArraySize size;
1736         parseContext.arraySizeCheck($3->getLoc(), $3, size, "array size");
1737         $$.arraySizes->addInnerSize(size);
1738     }
1739     ;
1740
1741 type_parameter_specifier_opt
1742     : type_parameter_specifier {
1743         $$ = $1;
1744     }
1745     | /* May be null */ {
1746         $$ = 0;
1747     }
1748     ;
1749
1750 type_parameter_specifier
1751     : LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE {
1752         $$ = $2;
1753     }
1754     ;
1755
1756 type_parameter_specifier_list
1757     : unary_expression {
1758         $$ = new TArraySizes;
1759
1760         TArraySize size;
1761         parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter");
1762         $$->addInnerSize(size);
1763     }
1764     | type_parameter_specifier_list COMMA unary_expression {
1765         $$ = $1;
1766
1767         TArraySize size;
1768         parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter");
1769         $$->addInnerSize(size);
1770     }
1771     ;
1772
1773 type_specifier_nonarray
1774     : VOID {
1775         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1776         $$.basicType = EbtVoid;
1777     }
1778     | FLOAT {
1779         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1780         $$.basicType = EbtFloat;
1781     }
1782     | INT {
1783         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1784         $$.basicType = EbtInt;
1785     }
1786     | UINT {
1787         parseContext.fullIntegerCheck($1.loc, "unsigned integer");
1788         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1789         $$.basicType = EbtUint;
1790     }
1791     | BOOL {
1792         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1793         $$.basicType = EbtBool;
1794     }
1795     | VEC2 {
1796         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1797         $$.basicType = EbtFloat;
1798         $$.setVector(2);
1799     }
1800     | VEC3 {
1801         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1802         $$.basicType = EbtFloat;
1803         $$.setVector(3);
1804     }
1805     | VEC4 {
1806         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1807         $$.basicType = EbtFloat;
1808         $$.setVector(4);
1809     }
1810     | BVEC2 {
1811         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1812         $$.basicType = EbtBool;
1813         $$.setVector(2);
1814     }
1815     | BVEC3 {
1816         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1817         $$.basicType = EbtBool;
1818         $$.setVector(3);
1819     }
1820     | BVEC4 {
1821         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1822         $$.basicType = EbtBool;
1823         $$.setVector(4);
1824     }
1825     | IVEC2 {
1826         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1827         $$.basicType = EbtInt;
1828         $$.setVector(2);
1829     }
1830     | IVEC3 {
1831         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1832         $$.basicType = EbtInt;
1833         $$.setVector(3);
1834     }
1835     | IVEC4 {
1836         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1837         $$.basicType = EbtInt;
1838         $$.setVector(4);
1839     }
1840     | UVEC2 {
1841         parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1842         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1843         $$.basicType = EbtUint;
1844         $$.setVector(2);
1845     }
1846     | UVEC3 {
1847         parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1848         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1849         $$.basicType = EbtUint;
1850         $$.setVector(3);
1851     }
1852     | UVEC4 {
1853         parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1854         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1855         $$.basicType = EbtUint;
1856         $$.setVector(4);
1857     }
1858     | MAT2 {
1859         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1860         $$.basicType = EbtFloat;
1861         $$.setMatrix(2, 2);
1862     }
1863     | MAT3 {
1864         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1865         $$.basicType = EbtFloat;
1866         $$.setMatrix(3, 3);
1867     }
1868     | MAT4 {
1869         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1870         $$.basicType = EbtFloat;
1871         $$.setMatrix(4, 4);
1872     }
1873     | MAT2X2 {
1874         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1875         $$.basicType = EbtFloat;
1876         $$.setMatrix(2, 2);
1877     }
1878     | MAT2X3 {
1879         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1880         $$.basicType = EbtFloat;
1881         $$.setMatrix(2, 3);
1882     }
1883     | MAT2X4 {
1884         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1885         $$.basicType = EbtFloat;
1886         $$.setMatrix(2, 4);
1887     }
1888     | MAT3X2 {
1889         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1890         $$.basicType = EbtFloat;
1891         $$.setMatrix(3, 2);
1892     }
1893     | MAT3X3 {
1894         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1895         $$.basicType = EbtFloat;
1896         $$.setMatrix(3, 3);
1897     }
1898     | MAT3X4 {
1899         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1900         $$.basicType = EbtFloat;
1901         $$.setMatrix(3, 4);
1902     }
1903     | MAT4X2 {
1904         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1905         $$.basicType = EbtFloat;
1906         $$.setMatrix(4, 2);
1907     }
1908     | MAT4X3 {
1909         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1910         $$.basicType = EbtFloat;
1911         $$.setMatrix(4, 3);
1912     }
1913     | MAT4X4 {
1914         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1915         $$.basicType = EbtFloat;
1916         $$.setMatrix(4, 4);
1917     }
1918 GLSLANG_WEB_EXCLUDE_ON
1919     | DOUBLE {
1920         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double");
1921         if (! parseContext.symbolTable.atBuiltInLevel())
1922             parseContext.doubleCheck($1.loc, "double");
1923         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1924         $$.basicType = EbtDouble;
1925     }
1926     | FLOAT16_T {
1927         parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel());
1928         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1929         $$.basicType = EbtFloat16;
1930     }
1931     | FLOAT32_T {
1932         parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel());
1933         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1934         $$.basicType = EbtFloat;
1935     }
1936     | FLOAT64_T {
1937         parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel());
1938         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1939         $$.basicType = EbtDouble;
1940     }
1941     | INT8_T {
1942         parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1943         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1944         $$.basicType = EbtInt8;
1945     }
1946     | UINT8_T {
1947         parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1948         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1949         $$.basicType = EbtUint8;
1950     }
1951     | INT16_T {
1952         parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1953         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1954         $$.basicType = EbtInt16;
1955     }
1956     | UINT16_T {
1957         parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1958         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1959         $$.basicType = EbtUint16;
1960     }
1961     | INT32_T {
1962         parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1963         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1964         $$.basicType = EbtInt;
1965     }
1966     | UINT32_T {
1967         parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1968         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1969         $$.basicType = EbtUint;
1970     }
1971     | INT64_T {
1972         parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel());
1973         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1974         $$.basicType = EbtInt64;
1975     }
1976     | UINT64_T {
1977         parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1978         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1979         $$.basicType = EbtUint64;
1980     }
1981     | DVEC2 {
1982         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1983         if (! parseContext.symbolTable.atBuiltInLevel())
1984             parseContext.doubleCheck($1.loc, "double vector");
1985         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1986         $$.basicType = EbtDouble;
1987         $$.setVector(2);
1988     }
1989     | DVEC3 {
1990         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1991         if (! parseContext.symbolTable.atBuiltInLevel())
1992             parseContext.doubleCheck($1.loc, "double vector");
1993         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1994         $$.basicType = EbtDouble;
1995         $$.setVector(3);
1996     }
1997     | DVEC4 {
1998         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1999         if (! parseContext.symbolTable.atBuiltInLevel())
2000             parseContext.doubleCheck($1.loc, "double vector");
2001         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2002         $$.basicType = EbtDouble;
2003         $$.setVector(4);
2004     }
2005     | F16VEC2 {
2006         parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
2007         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2008         $$.basicType = EbtFloat16;
2009         $$.setVector(2);
2010     }
2011     | F16VEC3 {
2012         parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
2013         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2014         $$.basicType = EbtFloat16;
2015         $$.setVector(3);
2016     }
2017     | F16VEC4 {
2018         parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
2019         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2020         $$.basicType = EbtFloat16;
2021         $$.setVector(4);
2022     }
2023     | F32VEC2 {
2024         parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
2025         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2026         $$.basicType = EbtFloat;
2027         $$.setVector(2);
2028     }
2029     | F32VEC3 {
2030         parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
2031         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2032         $$.basicType = EbtFloat;
2033         $$.setVector(3);
2034     }
2035     | F32VEC4 {
2036         parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
2037         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2038         $$.basicType = EbtFloat;
2039         $$.setVector(4);
2040     }
2041     | F64VEC2 {
2042         parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
2043         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2044         $$.basicType = EbtDouble;
2045         $$.setVector(2);
2046     }
2047     | F64VEC3 {
2048         parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
2049         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2050         $$.basicType = EbtDouble;
2051         $$.setVector(3);
2052     }
2053     | F64VEC4 {
2054         parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
2055         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2056         $$.basicType = EbtDouble;
2057         $$.setVector(4);
2058     }
2059     | I8VEC2 {
2060         parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2061         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2062         $$.basicType = EbtInt8;
2063         $$.setVector(2);
2064     }
2065     | I8VEC3 {
2066         parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2067         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2068         $$.basicType = EbtInt8;
2069         $$.setVector(3);
2070     }
2071     | I8VEC4 {
2072         parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2073         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2074         $$.basicType = EbtInt8;
2075         $$.setVector(4);
2076     }
2077     | I16VEC2 {
2078         parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2079         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2080         $$.basicType = EbtInt16;
2081         $$.setVector(2);
2082     }
2083     | I16VEC3 {
2084         parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2085         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2086         $$.basicType = EbtInt16;
2087         $$.setVector(3);
2088     }
2089     | I16VEC4 {
2090         parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2091         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2092         $$.basicType = EbtInt16;
2093         $$.setVector(4);
2094     }
2095     | I32VEC2 {
2096         parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2097         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2098         $$.basicType = EbtInt;
2099         $$.setVector(2);
2100     }
2101     | I32VEC3 {
2102         parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2103         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2104         $$.basicType = EbtInt;
2105         $$.setVector(3);
2106     }
2107     | I32VEC4 {
2108         parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2109         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2110         $$.basicType = EbtInt;
2111         $$.setVector(4);
2112     }
2113     | I64VEC2 {
2114         parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
2115         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2116         $$.basicType = EbtInt64;
2117         $$.setVector(2);
2118     }
2119     | I64VEC3 {
2120         parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
2121         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2122         $$.basicType = EbtInt64;
2123         $$.setVector(3);
2124     }
2125     | I64VEC4 {
2126         parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
2127         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2128         $$.basicType = EbtInt64;
2129         $$.setVector(4);
2130     }
2131     | U8VEC2 {
2132         parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2133         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2134         $$.basicType = EbtUint8;
2135         $$.setVector(2);
2136     }
2137     | U8VEC3 {
2138         parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2139         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2140         $$.basicType = EbtUint8;
2141         $$.setVector(3);
2142     }
2143     | U8VEC4 {
2144         parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2145         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2146         $$.basicType = EbtUint8;
2147         $$.setVector(4);
2148     }
2149     | U16VEC2 {
2150         parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2151         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2152         $$.basicType = EbtUint16;
2153         $$.setVector(2);
2154     }
2155     | U16VEC3 {
2156         parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2157         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2158         $$.basicType = EbtUint16;
2159         $$.setVector(3);
2160     }
2161     | U16VEC4 {
2162         parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2163         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2164         $$.basicType = EbtUint16;
2165         $$.setVector(4);
2166     }
2167     | U32VEC2 {
2168         parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2169         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2170         $$.basicType = EbtUint;
2171         $$.setVector(2);
2172     }
2173     | U32VEC3 {
2174         parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2175         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2176         $$.basicType = EbtUint;
2177         $$.setVector(3);
2178     }
2179     | U32VEC4 {
2180         parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2181         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2182         $$.basicType = EbtUint;
2183         $$.setVector(4);
2184     }
2185     | U64VEC2 {
2186         parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2187         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2188         $$.basicType = EbtUint64;
2189         $$.setVector(2);
2190     }
2191     | U64VEC3 {
2192         parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2193         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2194         $$.basicType = EbtUint64;
2195         $$.setVector(3);
2196     }
2197     | U64VEC4 {
2198         parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2199         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2200         $$.basicType = EbtUint64;
2201         $$.setVector(4);
2202     }
2203     | DMAT2 {
2204         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2205         if (! parseContext.symbolTable.atBuiltInLevel())
2206             parseContext.doubleCheck($1.loc, "double matrix");
2207         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2208         $$.basicType = EbtDouble;
2209         $$.setMatrix(2, 2);
2210     }
2211     | DMAT3 {
2212         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2213         if (! parseContext.symbolTable.atBuiltInLevel())
2214             parseContext.doubleCheck($1.loc, "double matrix");
2215         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2216         $$.basicType = EbtDouble;
2217         $$.setMatrix(3, 3);
2218     }
2219     | DMAT4 {
2220         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2221         if (! parseContext.symbolTable.atBuiltInLevel())
2222             parseContext.doubleCheck($1.loc, "double matrix");
2223         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2224         $$.basicType = EbtDouble;
2225         $$.setMatrix(4, 4);
2226     }
2227     | DMAT2X2 {
2228         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2229         if (! parseContext.symbolTable.atBuiltInLevel())
2230             parseContext.doubleCheck($1.loc, "double matrix");
2231         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2232         $$.basicType = EbtDouble;
2233         $$.setMatrix(2, 2);
2234     }
2235     | DMAT2X3 {
2236         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2237         if (! parseContext.symbolTable.atBuiltInLevel())
2238             parseContext.doubleCheck($1.loc, "double matrix");
2239         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2240         $$.basicType = EbtDouble;
2241         $$.setMatrix(2, 3);
2242     }
2243     | DMAT2X4 {
2244         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2245         if (! parseContext.symbolTable.atBuiltInLevel())
2246             parseContext.doubleCheck($1.loc, "double matrix");
2247         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2248         $$.basicType = EbtDouble;
2249         $$.setMatrix(2, 4);
2250     }
2251     | DMAT3X2 {
2252         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2253         if (! parseContext.symbolTable.atBuiltInLevel())
2254             parseContext.doubleCheck($1.loc, "double matrix");
2255         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2256         $$.basicType = EbtDouble;
2257         $$.setMatrix(3, 2);
2258     }
2259     | DMAT3X3 {
2260         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2261         if (! parseContext.symbolTable.atBuiltInLevel())
2262             parseContext.doubleCheck($1.loc, "double matrix");
2263         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2264         $$.basicType = EbtDouble;
2265         $$.setMatrix(3, 3);
2266     }
2267     | DMAT3X4 {
2268         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2269         if (! parseContext.symbolTable.atBuiltInLevel())
2270             parseContext.doubleCheck($1.loc, "double matrix");
2271         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2272         $$.basicType = EbtDouble;
2273         $$.setMatrix(3, 4);
2274     }
2275     | DMAT4X2 {
2276         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2277         if (! parseContext.symbolTable.atBuiltInLevel())
2278             parseContext.doubleCheck($1.loc, "double matrix");
2279         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2280         $$.basicType = EbtDouble;
2281         $$.setMatrix(4, 2);
2282     }
2283     | DMAT4X3 {
2284         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2285         if (! parseContext.symbolTable.atBuiltInLevel())
2286             parseContext.doubleCheck($1.loc, "double matrix");
2287         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2288         $$.basicType = EbtDouble;
2289         $$.setMatrix(4, 3);
2290     }
2291     | DMAT4X4 {
2292         parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2293         if (! parseContext.symbolTable.atBuiltInLevel())
2294             parseContext.doubleCheck($1.loc, "double matrix");
2295         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2296         $$.basicType = EbtDouble;
2297         $$.setMatrix(4, 4);
2298     }
2299     | F16MAT2 {
2300         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2301         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2302         $$.basicType = EbtFloat16;
2303         $$.setMatrix(2, 2);
2304     }
2305     | F16MAT3 {
2306         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2307         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2308         $$.basicType = EbtFloat16;
2309         $$.setMatrix(3, 3);
2310     }
2311     | F16MAT4 {
2312         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2313         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2314         $$.basicType = EbtFloat16;
2315         $$.setMatrix(4, 4);
2316     }
2317     | F16MAT2X2 {
2318         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2319         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2320         $$.basicType = EbtFloat16;
2321         $$.setMatrix(2, 2);
2322     }
2323     | F16MAT2X3 {
2324         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2325         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2326         $$.basicType = EbtFloat16;
2327         $$.setMatrix(2, 3);
2328     }
2329     | F16MAT2X4 {
2330         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2331         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2332         $$.basicType = EbtFloat16;
2333         $$.setMatrix(2, 4);
2334     }
2335     | F16MAT3X2 {
2336         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2337         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2338         $$.basicType = EbtFloat16;
2339         $$.setMatrix(3, 2);
2340     }
2341     | F16MAT3X3 {
2342         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2343         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2344         $$.basicType = EbtFloat16;
2345         $$.setMatrix(3, 3);
2346     }
2347     | F16MAT3X4 {
2348         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2349         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2350         $$.basicType = EbtFloat16;
2351         $$.setMatrix(3, 4);
2352     }
2353     | F16MAT4X2 {
2354         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2355         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2356         $$.basicType = EbtFloat16;
2357         $$.setMatrix(4, 2);
2358     }
2359     | F16MAT4X3 {
2360         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2361         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2362         $$.basicType = EbtFloat16;
2363         $$.setMatrix(4, 3);
2364     }
2365     | F16MAT4X4 {
2366         parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2367         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2368         $$.basicType = EbtFloat16;
2369         $$.setMatrix(4, 4);
2370     }
2371     | F32MAT2 {
2372         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2373         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2374         $$.basicType = EbtFloat;
2375         $$.setMatrix(2, 2);
2376     }
2377     | F32MAT3 {
2378         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2379         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2380         $$.basicType = EbtFloat;
2381         $$.setMatrix(3, 3);
2382     }
2383     | F32MAT4 {
2384         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2385         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2386         $$.basicType = EbtFloat;
2387         $$.setMatrix(4, 4);
2388     }
2389     | F32MAT2X2 {
2390         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2391         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2392         $$.basicType = EbtFloat;
2393         $$.setMatrix(2, 2);
2394     }
2395     | F32MAT2X3 {
2396         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2397         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2398         $$.basicType = EbtFloat;
2399         $$.setMatrix(2, 3);
2400     }
2401     | F32MAT2X4 {
2402         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2403         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2404         $$.basicType = EbtFloat;
2405         $$.setMatrix(2, 4);
2406     }
2407     | F32MAT3X2 {
2408         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2409         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2410         $$.basicType = EbtFloat;
2411         $$.setMatrix(3, 2);
2412     }
2413     | F32MAT3X3 {
2414         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2415         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2416         $$.basicType = EbtFloat;
2417         $$.setMatrix(3, 3);
2418     }
2419     | F32MAT3X4 {
2420         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2421         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2422         $$.basicType = EbtFloat;
2423         $$.setMatrix(3, 4);
2424     }
2425     | F32MAT4X2 {
2426         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2427         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2428         $$.basicType = EbtFloat;
2429         $$.setMatrix(4, 2);
2430     }
2431     | F32MAT4X3 {
2432         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2433         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2434         $$.basicType = EbtFloat;
2435         $$.setMatrix(4, 3);
2436     }
2437     | F32MAT4X4 {
2438         parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2439         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2440         $$.basicType = EbtFloat;
2441         $$.setMatrix(4, 4);
2442     }
2443     | F64MAT2 {
2444         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2445         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2446         $$.basicType = EbtDouble;
2447         $$.setMatrix(2, 2);
2448     }
2449     | F64MAT3 {
2450         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2451         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2452         $$.basicType = EbtDouble;
2453         $$.setMatrix(3, 3);
2454     }
2455     | F64MAT4 {
2456         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2457         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2458         $$.basicType = EbtDouble;
2459         $$.setMatrix(4, 4);
2460     }
2461     | F64MAT2X2 {
2462         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2463         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2464         $$.basicType = EbtDouble;
2465         $$.setMatrix(2, 2);
2466     }
2467     | F64MAT2X3 {
2468         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2469         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2470         $$.basicType = EbtDouble;
2471         $$.setMatrix(2, 3);
2472     }
2473     | F64MAT2X4 {
2474         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2475         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2476         $$.basicType = EbtDouble;
2477         $$.setMatrix(2, 4);
2478     }
2479     | F64MAT3X2 {
2480         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2481         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2482         $$.basicType = EbtDouble;
2483         $$.setMatrix(3, 2);
2484     }
2485     | F64MAT3X3 {
2486         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2487         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2488         $$.basicType = EbtDouble;
2489         $$.setMatrix(3, 3);
2490     }
2491     | F64MAT3X4 {
2492         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2493         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2494         $$.basicType = EbtDouble;
2495         $$.setMatrix(3, 4);
2496     }
2497     | F64MAT4X2 {
2498         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2499         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2500         $$.basicType = EbtDouble;
2501         $$.setMatrix(4, 2);
2502     }
2503     | F64MAT4X3 {
2504         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2505         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2506         $$.basicType = EbtDouble;
2507         $$.setMatrix(4, 3);
2508     }
2509     | F64MAT4X4 {
2510         parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2511         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2512         $$.basicType = EbtDouble;
2513         $$.setMatrix(4, 4);
2514     }
2515     | ACCSTRUCTNV {
2516        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2517        $$.basicType = EbtAccStruct;
2518     }
2519     | ACCSTRUCTEXT {
2520        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2521        $$.basicType = EbtAccStruct;
2522     }
2523     | RAYQUERYEXT {
2524        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2525        $$.basicType = EbtRayQuery;
2526     }
2527     | ATOMIC_UINT {
2528         parseContext.vulkanRemoved($1.loc, "atomic counter types");
2529         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2530         $$.basicType = EbtAtomicUint;
2531     }
2532     | SAMPLER1D {
2533         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2534         $$.basicType = EbtSampler;
2535         $$.sampler.set(EbtFloat, Esd1D);
2536     }
2537 GLSLANG_WEB_EXCLUDE_OFF
2538     | SAMPLER2D {
2539         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2540         $$.basicType = EbtSampler;
2541         $$.sampler.set(EbtFloat, Esd2D);
2542     }
2543     | SAMPLER3D {
2544         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2545         $$.basicType = EbtSampler;
2546         $$.sampler.set(EbtFloat, Esd3D);
2547     }
2548     | SAMPLERCUBE {
2549         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2550         $$.basicType = EbtSampler;
2551         $$.sampler.set(EbtFloat, EsdCube);
2552     }
2553     | SAMPLER2DSHADOW {
2554         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2555         $$.basicType = EbtSampler;
2556         $$.sampler.set(EbtFloat, Esd2D, false, true);
2557     }
2558     | SAMPLERCUBESHADOW {
2559         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2560         $$.basicType = EbtSampler;
2561         $$.sampler.set(EbtFloat, EsdCube, false, true);
2562     }
2563     | SAMPLER2DARRAY {
2564         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2565         $$.basicType = EbtSampler;
2566         $$.sampler.set(EbtFloat, Esd2D, true);
2567     }
2568     | SAMPLER2DARRAYSHADOW {
2569         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2570         $$.basicType = EbtSampler;
2571         $$.sampler.set(EbtFloat, Esd2D, true, true);
2572     }
2573 GLSLANG_WEB_EXCLUDE_ON
2574     | SAMPLER1DSHADOW {
2575         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2576         $$.basicType = EbtSampler;
2577         $$.sampler.set(EbtFloat, Esd1D, false, true);
2578     }
2579     | SAMPLER1DARRAY {
2580         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2581         $$.basicType = EbtSampler;
2582         $$.sampler.set(EbtFloat, Esd1D, true);
2583     }
2584     | SAMPLER1DARRAYSHADOW {
2585         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2586         $$.basicType = EbtSampler;
2587         $$.sampler.set(EbtFloat, Esd1D, true, true);
2588     }
2589     | SAMPLERCUBEARRAY {
2590         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2591         $$.basicType = EbtSampler;
2592         $$.sampler.set(EbtFloat, EsdCube, true);
2593     }
2594     | SAMPLERCUBEARRAYSHADOW {
2595         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2596         $$.basicType = EbtSampler;
2597         $$.sampler.set(EbtFloat, EsdCube, true, true);
2598     }
2599     | F16SAMPLER1D {
2600         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2601         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2602         $$.basicType = EbtSampler;
2603         $$.sampler.set(EbtFloat16, Esd1D);
2604     }
2605     | F16SAMPLER2D {
2606         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2607         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2608         $$.basicType = EbtSampler;
2609         $$.sampler.set(EbtFloat16, Esd2D);
2610     }
2611     | F16SAMPLER3D {
2612         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2613         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2614         $$.basicType = EbtSampler;
2615         $$.sampler.set(EbtFloat16, Esd3D);
2616     }
2617     | F16SAMPLERCUBE {
2618         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2619         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2620         $$.basicType = EbtSampler;
2621         $$.sampler.set(EbtFloat16, EsdCube);
2622     }
2623     | F16SAMPLER1DSHADOW {
2624         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2625         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2626         $$.basicType = EbtSampler;
2627         $$.sampler.set(EbtFloat16, Esd1D, false, true);
2628     }
2629     | F16SAMPLER2DSHADOW {
2630         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2631         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2632         $$.basicType = EbtSampler;
2633         $$.sampler.set(EbtFloat16, Esd2D, false, true);
2634     }
2635     | F16SAMPLERCUBESHADOW {
2636         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2637         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2638         $$.basicType = EbtSampler;
2639         $$.sampler.set(EbtFloat16, EsdCube, false, true);
2640     }
2641     | F16SAMPLER1DARRAY {
2642         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2643         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2644         $$.basicType = EbtSampler;
2645         $$.sampler.set(EbtFloat16, Esd1D, true);
2646     }
2647     | F16SAMPLER2DARRAY {
2648         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2649         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2650         $$.basicType = EbtSampler;
2651         $$.sampler.set(EbtFloat16, Esd2D, true);
2652     }
2653     | F16SAMPLER1DARRAYSHADOW {
2654         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2655         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2656         $$.basicType = EbtSampler;
2657         $$.sampler.set(EbtFloat16, Esd1D, true, true);
2658     }
2659     | F16SAMPLER2DARRAYSHADOW {
2660         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2661         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2662         $$.basicType = EbtSampler;
2663         $$.sampler.set(EbtFloat16, Esd2D, true, true);
2664     }
2665     | F16SAMPLERCUBEARRAY {
2666         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2667         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2668         $$.basicType = EbtSampler;
2669         $$.sampler.set(EbtFloat16, EsdCube, true);
2670     }
2671     | F16SAMPLERCUBEARRAYSHADOW {
2672         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2673         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2674         $$.basicType = EbtSampler;
2675         $$.sampler.set(EbtFloat16, EsdCube, true, true);
2676     }
2677     | ISAMPLER1D {
2678         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2679         $$.basicType = EbtSampler;
2680         $$.sampler.set(EbtInt, Esd1D);
2681     }
2682 GLSLANG_WEB_EXCLUDE_OFF
2683     | ISAMPLER2D {
2684         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2685         $$.basicType = EbtSampler;
2686         $$.sampler.set(EbtInt, Esd2D);
2687     }
2688     | ISAMPLER3D {
2689         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2690         $$.basicType = EbtSampler;
2691         $$.sampler.set(EbtInt, Esd3D);
2692     }
2693     | ISAMPLERCUBE {
2694         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2695         $$.basicType = EbtSampler;
2696         $$.sampler.set(EbtInt, EsdCube);
2697     }
2698     | ISAMPLER2DARRAY {
2699         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2700         $$.basicType = EbtSampler;
2701         $$.sampler.set(EbtInt, Esd2D, true);
2702     }
2703     | USAMPLER2D {
2704         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2705         $$.basicType = EbtSampler;
2706         $$.sampler.set(EbtUint, Esd2D);
2707     }
2708     | USAMPLER3D {
2709         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2710         $$.basicType = EbtSampler;
2711         $$.sampler.set(EbtUint, Esd3D);
2712     }
2713     | USAMPLERCUBE {
2714         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2715         $$.basicType = EbtSampler;
2716         $$.sampler.set(EbtUint, EsdCube);
2717     }
2718 GLSLANG_WEB_EXCLUDE_ON
2719     | ISAMPLER1DARRAY {
2720         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2721         $$.basicType = EbtSampler;
2722         $$.sampler.set(EbtInt, Esd1D, true);
2723     }
2724     | ISAMPLERCUBEARRAY {
2725         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2726         $$.basicType = EbtSampler;
2727         $$.sampler.set(EbtInt, EsdCube, true);
2728     }
2729     | USAMPLER1D {
2730         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2731         $$.basicType = EbtSampler;
2732         $$.sampler.set(EbtUint, Esd1D);
2733     }
2734     | USAMPLER1DARRAY {
2735         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2736         $$.basicType = EbtSampler;
2737         $$.sampler.set(EbtUint, Esd1D, true);
2738     }
2739     | USAMPLERCUBEARRAY {
2740         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2741         $$.basicType = EbtSampler;
2742         $$.sampler.set(EbtUint, EsdCube, true);
2743     }
2744     | TEXTURECUBEARRAY {
2745         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2746         $$.basicType = EbtSampler;
2747         $$.sampler.setTexture(EbtFloat, EsdCube, true);
2748     }
2749     | ITEXTURECUBEARRAY {
2750         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2751         $$.basicType = EbtSampler;
2752         $$.sampler.setTexture(EbtInt, EsdCube, true);
2753     }
2754     | UTEXTURECUBEARRAY {
2755         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2756         $$.basicType = EbtSampler;
2757         $$.sampler.setTexture(EbtUint, EsdCube, true);
2758     }
2759 GLSLANG_WEB_EXCLUDE_OFF
2760     | USAMPLER2DARRAY {
2761         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2762         $$.basicType = EbtSampler;
2763         $$.sampler.set(EbtUint, Esd2D, true);
2764     }
2765     | TEXTURE2D {
2766         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2767         $$.basicType = EbtSampler;
2768         $$.sampler.setTexture(EbtFloat, Esd2D);
2769     }
2770     | TEXTURE3D {
2771         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2772         $$.basicType = EbtSampler;
2773         $$.sampler.setTexture(EbtFloat, Esd3D);
2774     }
2775     | TEXTURE2DARRAY {
2776         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2777         $$.basicType = EbtSampler;
2778         $$.sampler.setTexture(EbtFloat, Esd2D, true);
2779     }
2780     | TEXTURECUBE {
2781         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2782         $$.basicType = EbtSampler;
2783         $$.sampler.setTexture(EbtFloat, EsdCube);
2784     }
2785     | ITEXTURE2D {
2786         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2787         $$.basicType = EbtSampler;
2788         $$.sampler.setTexture(EbtInt, Esd2D);
2789     }
2790     | ITEXTURE3D {
2791         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2792         $$.basicType = EbtSampler;
2793         $$.sampler.setTexture(EbtInt, Esd3D);
2794     }
2795     | ITEXTURECUBE {
2796         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2797         $$.basicType = EbtSampler;
2798         $$.sampler.setTexture(EbtInt, EsdCube);
2799     }
2800     | ITEXTURE2DARRAY {
2801         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2802         $$.basicType = EbtSampler;
2803         $$.sampler.setTexture(EbtInt, Esd2D, true);
2804     }
2805     | UTEXTURE2D {
2806         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2807         $$.basicType = EbtSampler;
2808         $$.sampler.setTexture(EbtUint, Esd2D);
2809     }
2810     | UTEXTURE3D {
2811         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2812         $$.basicType = EbtSampler;
2813         $$.sampler.setTexture(EbtUint, Esd3D);
2814     }
2815     | UTEXTURECUBE {
2816         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2817         $$.basicType = EbtSampler;
2818         $$.sampler.setTexture(EbtUint, EsdCube);
2819     }
2820     | UTEXTURE2DARRAY {
2821         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2822         $$.basicType = EbtSampler;
2823         $$.sampler.setTexture(EbtUint, Esd2D, true);
2824     }
2825     | SAMPLER {
2826         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2827         $$.basicType = EbtSampler;
2828         $$.sampler.setPureSampler(false);
2829     }
2830     | SAMPLERSHADOW {
2831         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2832         $$.basicType = EbtSampler;
2833         $$.sampler.setPureSampler(true);
2834     }
2835 GLSLANG_WEB_EXCLUDE_ON
2836     | SAMPLER2DRECT {
2837         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2838         $$.basicType = EbtSampler;
2839         $$.sampler.set(EbtFloat, EsdRect);
2840     }
2841     | SAMPLER2DRECTSHADOW {
2842         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2843         $$.basicType = EbtSampler;
2844         $$.sampler.set(EbtFloat, EsdRect, false, true);
2845     }
2846     | F16SAMPLER2DRECT {
2847         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2848         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2849         $$.basicType = EbtSampler;
2850         $$.sampler.set(EbtFloat16, EsdRect);
2851     }
2852     | F16SAMPLER2DRECTSHADOW {
2853         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2854         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2855         $$.basicType = EbtSampler;
2856         $$.sampler.set(EbtFloat16, EsdRect, false, true);
2857     }
2858     | ISAMPLER2DRECT {
2859         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2860         $$.basicType = EbtSampler;
2861         $$.sampler.set(EbtInt, EsdRect);
2862     }
2863     | USAMPLER2DRECT {
2864         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2865         $$.basicType = EbtSampler;
2866         $$.sampler.set(EbtUint, EsdRect);
2867     }
2868     | SAMPLERBUFFER {
2869         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2870         $$.basicType = EbtSampler;
2871         $$.sampler.set(EbtFloat, EsdBuffer);
2872     }
2873     | F16SAMPLERBUFFER {
2874         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2875         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2876         $$.basicType = EbtSampler;
2877         $$.sampler.set(EbtFloat16, EsdBuffer);
2878     }
2879     | ISAMPLERBUFFER {
2880         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2881         $$.basicType = EbtSampler;
2882         $$.sampler.set(EbtInt, EsdBuffer);
2883     }
2884     | USAMPLERBUFFER {
2885         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2886         $$.basicType = EbtSampler;
2887         $$.sampler.set(EbtUint, EsdBuffer);
2888     }
2889     | SAMPLER2DMS {
2890         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2891         $$.basicType = EbtSampler;
2892         $$.sampler.set(EbtFloat, Esd2D, false, false, true);
2893     }
2894     | F16SAMPLER2DMS {
2895         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2896         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2897         $$.basicType = EbtSampler;
2898         $$.sampler.set(EbtFloat16, Esd2D, false, false, true);
2899     }
2900     | ISAMPLER2DMS {
2901         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2902         $$.basicType = EbtSampler;
2903         $$.sampler.set(EbtInt, Esd2D, false, false, true);
2904     }
2905     | USAMPLER2DMS {
2906         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2907         $$.basicType = EbtSampler;
2908         $$.sampler.set(EbtUint, Esd2D, false, false, true);
2909     }
2910     | SAMPLER2DMSARRAY {
2911         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2912         $$.basicType = EbtSampler;
2913         $$.sampler.set(EbtFloat, Esd2D, true, false, true);
2914     }
2915     | F16SAMPLER2DMSARRAY {
2916         parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2917         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2918         $$.basicType = EbtSampler;
2919         $$.sampler.set(EbtFloat16, Esd2D, true, false, true);
2920     }
2921     | ISAMPLER2DMSARRAY {
2922         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2923         $$.basicType = EbtSampler;
2924         $$.sampler.set(EbtInt, Esd2D, true, false, true);
2925     }
2926     | USAMPLER2DMSARRAY {
2927         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2928         $$.basicType = EbtSampler;
2929         $$.sampler.set(EbtUint, Esd2D, true, false, true);
2930     }
2931     | TEXTURE1D {
2932         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2933         $$.basicType = EbtSampler;
2934         $$.sampler.setTexture(EbtFloat, Esd1D);
2935     }
2936     | F16TEXTURE1D {
2937         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2938         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2939         $$.basicType = EbtSampler;
2940         $$.sampler.setTexture(EbtFloat16, Esd1D);
2941     }
2942     | F16TEXTURE2D {
2943         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2944         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2945         $$.basicType = EbtSampler;
2946         $$.sampler.setTexture(EbtFloat16, Esd2D);
2947     }
2948     | F16TEXTURE3D {
2949         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2950         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2951         $$.basicType = EbtSampler;
2952         $$.sampler.setTexture(EbtFloat16, Esd3D);
2953     }
2954     | F16TEXTURECUBE {
2955         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2956         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2957         $$.basicType = EbtSampler;
2958         $$.sampler.setTexture(EbtFloat16, EsdCube);
2959     }
2960     | TEXTURE1DARRAY {
2961         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2962         $$.basicType = EbtSampler;
2963         $$.sampler.setTexture(EbtFloat, Esd1D, true);
2964     }
2965     | F16TEXTURE1DARRAY {
2966         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2967         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2968         $$.basicType = EbtSampler;
2969         $$.sampler.setTexture(EbtFloat16, Esd1D, true);
2970     }
2971     | F16TEXTURE2DARRAY {
2972         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2973         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2974         $$.basicType = EbtSampler;
2975         $$.sampler.setTexture(EbtFloat16, Esd2D, true);
2976     }
2977     | F16TEXTURECUBEARRAY {
2978         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2979         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2980         $$.basicType = EbtSampler;
2981         $$.sampler.setTexture(EbtFloat16, EsdCube, true);
2982     }
2983     | ITEXTURE1D {
2984         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2985         $$.basicType = EbtSampler;
2986         $$.sampler.setTexture(EbtInt, Esd1D);
2987     }
2988     | ITEXTURE1DARRAY {
2989         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2990         $$.basicType = EbtSampler;
2991         $$.sampler.setTexture(EbtInt, Esd1D, true);
2992     }
2993     | UTEXTURE1D {
2994         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2995         $$.basicType = EbtSampler;
2996         $$.sampler.setTexture(EbtUint, Esd1D);
2997     }
2998     | UTEXTURE1DARRAY {
2999         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3000         $$.basicType = EbtSampler;
3001         $$.sampler.setTexture(EbtUint, Esd1D, true);
3002     }
3003     | TEXTURE2DRECT {
3004         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3005         $$.basicType = EbtSampler;
3006         $$.sampler.setTexture(EbtFloat, EsdRect);
3007     }
3008     | F16TEXTURE2DRECT {
3009         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
3010         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3011         $$.basicType = EbtSampler;
3012         $$.sampler.setTexture(EbtFloat16, EsdRect);
3013     }
3014     | ITEXTURE2DRECT {
3015         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3016         $$.basicType = EbtSampler;
3017         $$.sampler.setTexture(EbtInt, EsdRect);
3018     }
3019     | UTEXTURE2DRECT {
3020         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3021         $$.basicType = EbtSampler;
3022         $$.sampler.setTexture(EbtUint, EsdRect);
3023     }
3024     | TEXTUREBUFFER {
3025         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3026         $$.basicType = EbtSampler;
3027         $$.sampler.setTexture(EbtFloat, EsdBuffer);
3028     }
3029     | F16TEXTUREBUFFER {
3030         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
3031         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3032         $$.basicType = EbtSampler;
3033         $$.sampler.setTexture(EbtFloat16, EsdBuffer);
3034     }
3035     | ITEXTUREBUFFER {
3036         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3037         $$.basicType = EbtSampler;
3038         $$.sampler.setTexture(EbtInt, EsdBuffer);
3039     }
3040     | UTEXTUREBUFFER {
3041         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3042         $$.basicType = EbtSampler;
3043         $$.sampler.setTexture(EbtUint, EsdBuffer);
3044     }
3045     | TEXTURE2DMS {
3046         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3047         $$.basicType = EbtSampler;
3048         $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true);
3049     }
3050     | F16TEXTURE2DMS {
3051         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
3052         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3053         $$.basicType = EbtSampler;
3054         $$.sampler.setTexture(EbtFloat16, Esd2D, false, false, true);
3055     }
3056     | ITEXTURE2DMS {
3057         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3058         $$.basicType = EbtSampler;
3059         $$.sampler.setTexture(EbtInt, Esd2D, false, false, true);
3060     }
3061     | UTEXTURE2DMS {
3062         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3063         $$.basicType = EbtSampler;
3064         $$.sampler.setTexture(EbtUint, Esd2D, false, false, true);
3065     }
3066     | TEXTURE2DMSARRAY {
3067         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3068         $$.basicType = EbtSampler;
3069         $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true);
3070     }
3071     | F16TEXTURE2DMSARRAY {
3072         parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
3073         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3074         $$.basicType = EbtSampler;
3075         $$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true);
3076     }
3077     | ITEXTURE2DMSARRAY {
3078         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3079         $$.basicType = EbtSampler;
3080         $$.sampler.setTexture(EbtInt, Esd2D, true, false, true);
3081     }
3082     | UTEXTURE2DMSARRAY {
3083         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3084         $$.basicType = EbtSampler;
3085         $$.sampler.setTexture(EbtUint, Esd2D, true, false, true);
3086     }
3087     | IMAGE1D {
3088         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3089         $$.basicType = EbtSampler;
3090         $$.sampler.setImage(EbtFloat, Esd1D);
3091     }
3092     | F16IMAGE1D {
3093         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3094         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3095         $$.basicType = EbtSampler;
3096         $$.sampler.setImage(EbtFloat16, Esd1D);
3097     }
3098     | IIMAGE1D {
3099         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3100         $$.basicType = EbtSampler;
3101         $$.sampler.setImage(EbtInt, Esd1D);
3102     }
3103     | UIMAGE1D {
3104         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3105         $$.basicType = EbtSampler;
3106         $$.sampler.setImage(EbtUint, Esd1D);
3107     }
3108     | IMAGE2D {
3109         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3110         $$.basicType = EbtSampler;
3111         $$.sampler.setImage(EbtFloat, Esd2D);
3112     }
3113     | F16IMAGE2D {
3114         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3115         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3116         $$.basicType = EbtSampler;
3117         $$.sampler.setImage(EbtFloat16, Esd2D);
3118     }
3119     | IIMAGE2D {
3120         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3121         $$.basicType = EbtSampler;
3122         $$.sampler.setImage(EbtInt, Esd2D);
3123     }
3124     | UIMAGE2D {
3125         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3126         $$.basicType = EbtSampler;
3127         $$.sampler.setImage(EbtUint, Esd2D);
3128     }
3129     | IMAGE3D {
3130         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3131         $$.basicType = EbtSampler;
3132         $$.sampler.setImage(EbtFloat, Esd3D);
3133     }
3134     | F16IMAGE3D {
3135         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3136         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3137         $$.basicType = EbtSampler;
3138         $$.sampler.setImage(EbtFloat16, Esd3D);
3139     }
3140     | IIMAGE3D {
3141         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3142         $$.basicType = EbtSampler;
3143         $$.sampler.setImage(EbtInt, Esd3D);
3144     }
3145     | UIMAGE3D {
3146         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3147         $$.basicType = EbtSampler;
3148         $$.sampler.setImage(EbtUint, Esd3D);
3149     }
3150     | IMAGE2DRECT {
3151         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3152         $$.basicType = EbtSampler;
3153         $$.sampler.setImage(EbtFloat, EsdRect);
3154     }
3155     | F16IMAGE2DRECT {
3156         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3157         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3158         $$.basicType = EbtSampler;
3159         $$.sampler.setImage(EbtFloat16, EsdRect);
3160     }
3161     | IIMAGE2DRECT {
3162         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3163         $$.basicType = EbtSampler;
3164         $$.sampler.setImage(EbtInt, EsdRect);
3165     }
3166     | UIMAGE2DRECT {
3167         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3168         $$.basicType = EbtSampler;
3169         $$.sampler.setImage(EbtUint, EsdRect);
3170     }
3171     | IMAGECUBE {
3172         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3173         $$.basicType = EbtSampler;
3174         $$.sampler.setImage(EbtFloat, EsdCube);
3175     }
3176     | F16IMAGECUBE {
3177         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3178         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3179         $$.basicType = EbtSampler;
3180         $$.sampler.setImage(EbtFloat16, EsdCube);
3181     }
3182     | IIMAGECUBE {
3183         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3184         $$.basicType = EbtSampler;
3185         $$.sampler.setImage(EbtInt, EsdCube);
3186     }
3187     | UIMAGECUBE {
3188         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3189         $$.basicType = EbtSampler;
3190         $$.sampler.setImage(EbtUint, EsdCube);
3191     }
3192     | IMAGEBUFFER {
3193         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3194         $$.basicType = EbtSampler;
3195         $$.sampler.setImage(EbtFloat, EsdBuffer);
3196     }
3197     | F16IMAGEBUFFER {
3198         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3199         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3200         $$.basicType = EbtSampler;
3201         $$.sampler.setImage(EbtFloat16, EsdBuffer);
3202     }
3203     | IIMAGEBUFFER {
3204         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3205         $$.basicType = EbtSampler;
3206         $$.sampler.setImage(EbtInt, EsdBuffer);
3207     }
3208     | UIMAGEBUFFER {
3209         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3210         $$.basicType = EbtSampler;
3211         $$.sampler.setImage(EbtUint, EsdBuffer);
3212     }
3213     | IMAGE1DARRAY {
3214         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3215         $$.basicType = EbtSampler;
3216         $$.sampler.setImage(EbtFloat, Esd1D, true);
3217     }
3218     | F16IMAGE1DARRAY {
3219         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3220         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3221         $$.basicType = EbtSampler;
3222         $$.sampler.setImage(EbtFloat16, Esd1D, true);
3223     }
3224     | IIMAGE1DARRAY {
3225         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3226         $$.basicType = EbtSampler;
3227         $$.sampler.setImage(EbtInt, Esd1D, true);
3228     }
3229     | UIMAGE1DARRAY {
3230         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3231         $$.basicType = EbtSampler;
3232         $$.sampler.setImage(EbtUint, Esd1D, true);
3233     }
3234     | IMAGE2DARRAY {
3235         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3236         $$.basicType = EbtSampler;
3237         $$.sampler.setImage(EbtFloat, Esd2D, true);
3238     }
3239     | F16IMAGE2DARRAY {
3240         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3241         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3242         $$.basicType = EbtSampler;
3243         $$.sampler.setImage(EbtFloat16, Esd2D, true);
3244     }
3245     | IIMAGE2DARRAY {
3246         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3247         $$.basicType = EbtSampler;
3248         $$.sampler.setImage(EbtInt, Esd2D, true);
3249     }
3250     | UIMAGE2DARRAY {
3251         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3252         $$.basicType = EbtSampler;
3253         $$.sampler.setImage(EbtUint, Esd2D, true);
3254     }
3255     | IMAGECUBEARRAY {
3256         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3257         $$.basicType = EbtSampler;
3258         $$.sampler.setImage(EbtFloat, EsdCube, true);
3259     }
3260     | F16IMAGECUBEARRAY {
3261         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3262         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3263         $$.basicType = EbtSampler;
3264         $$.sampler.setImage(EbtFloat16, EsdCube, true);
3265     }
3266     | IIMAGECUBEARRAY {
3267         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3268         $$.basicType = EbtSampler;
3269         $$.sampler.setImage(EbtInt, EsdCube, true);
3270     }
3271     | UIMAGECUBEARRAY {
3272         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3273         $$.basicType = EbtSampler;
3274         $$.sampler.setImage(EbtUint, EsdCube, true);
3275     }
3276     | IMAGE2DMS {
3277         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3278         $$.basicType = EbtSampler;
3279         $$.sampler.setImage(EbtFloat, Esd2D, false, false, true);
3280     }
3281     | F16IMAGE2DMS {
3282         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3283         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3284         $$.basicType = EbtSampler;
3285         $$.sampler.setImage(EbtFloat16, Esd2D, false, false, true);
3286     }
3287     | IIMAGE2DMS {
3288         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3289         $$.basicType = EbtSampler;
3290         $$.sampler.setImage(EbtInt, Esd2D, false, false, true);
3291     }
3292     | UIMAGE2DMS {
3293         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3294         $$.basicType = EbtSampler;
3295         $$.sampler.setImage(EbtUint, Esd2D, false, false, true);
3296     }
3297     | IMAGE2DMSARRAY {
3298         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3299         $$.basicType = EbtSampler;
3300         $$.sampler.setImage(EbtFloat, Esd2D, true, false, true);
3301     }
3302     | F16IMAGE2DMSARRAY {
3303         parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3304         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3305         $$.basicType = EbtSampler;
3306         $$.sampler.setImage(EbtFloat16, Esd2D, true, false, true);
3307     }
3308     | IIMAGE2DMSARRAY {
3309         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3310         $$.basicType = EbtSampler;
3311         $$.sampler.setImage(EbtInt, Esd2D, true, false, true);
3312     }
3313     | UIMAGE2DMSARRAY {
3314         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3315         $$.basicType = EbtSampler;
3316         $$.sampler.setImage(EbtUint, Esd2D, true, false, true);
3317     }
3318     | I64IMAGE1D {
3319         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3320         $$.basicType = EbtSampler;
3321         $$.sampler.setImage(EbtInt64, Esd1D);
3322     }
3323     | U64IMAGE1D {
3324         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3325         $$.basicType = EbtSampler;
3326         $$.sampler.setImage(EbtUint64, Esd1D);
3327     }
3328     | I64IMAGE2D {
3329         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3330         $$.basicType = EbtSampler;
3331         $$.sampler.setImage(EbtInt64, Esd2D);
3332     }
3333     | U64IMAGE2D {
3334         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3335         $$.basicType = EbtSampler;
3336         $$.sampler.setImage(EbtUint64, Esd2D);
3337     }
3338     | I64IMAGE3D {
3339         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3340         $$.basicType = EbtSampler;
3341         $$.sampler.setImage(EbtInt64, Esd3D);
3342     }
3343     | U64IMAGE3D {
3344         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3345         $$.basicType = EbtSampler;
3346         $$.sampler.setImage(EbtUint64, Esd3D);
3347     }
3348     | I64IMAGE2DRECT {
3349         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3350         $$.basicType = EbtSampler;
3351         $$.sampler.setImage(EbtInt64, EsdRect);
3352     }
3353     | U64IMAGE2DRECT {
3354         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3355         $$.basicType = EbtSampler;
3356         $$.sampler.setImage(EbtUint64, EsdRect);
3357     }
3358     | I64IMAGECUBE {
3359         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3360         $$.basicType = EbtSampler;
3361         $$.sampler.setImage(EbtInt64, EsdCube);
3362     }
3363     | U64IMAGECUBE {
3364         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3365         $$.basicType = EbtSampler;
3366         $$.sampler.setImage(EbtUint64, EsdCube);
3367     }
3368     | I64IMAGEBUFFER {
3369         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3370         $$.basicType = EbtSampler;
3371         $$.sampler.setImage(EbtInt64, EsdBuffer);
3372     }
3373     | U64IMAGEBUFFER {
3374         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3375         $$.basicType = EbtSampler;
3376         $$.sampler.setImage(EbtUint64, EsdBuffer);
3377     }
3378     | I64IMAGE1DARRAY {
3379         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3380         $$.basicType = EbtSampler;
3381         $$.sampler.setImage(EbtInt64, Esd1D, true);
3382     }
3383     | U64IMAGE1DARRAY {
3384         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3385         $$.basicType = EbtSampler;
3386         $$.sampler.setImage(EbtUint64, Esd1D, true);
3387     }
3388     | I64IMAGE2DARRAY {
3389         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3390         $$.basicType = EbtSampler;
3391         $$.sampler.setImage(EbtInt64, Esd2D, true);
3392     }
3393     | U64IMAGE2DARRAY {
3394         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3395         $$.basicType = EbtSampler;
3396         $$.sampler.setImage(EbtUint64, Esd2D, true);
3397     }
3398     | I64IMAGECUBEARRAY {
3399         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3400         $$.basicType = EbtSampler;
3401         $$.sampler.setImage(EbtInt64, EsdCube, true);
3402     }
3403     | U64IMAGECUBEARRAY {
3404         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3405         $$.basicType = EbtSampler;
3406         $$.sampler.setImage(EbtUint64, EsdCube, true);
3407     }
3408     | I64IMAGE2DMS {
3409         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3410         $$.basicType = EbtSampler;
3411         $$.sampler.setImage(EbtInt64, Esd2D, false, false, true);
3412     }
3413     | U64IMAGE2DMS {
3414         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3415         $$.basicType = EbtSampler;
3416         $$.sampler.setImage(EbtUint64, Esd2D, false, false, true);
3417     }
3418     | I64IMAGE2DMSARRAY {
3419         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3420         $$.basicType = EbtSampler;
3421         $$.sampler.setImage(EbtInt64, Esd2D, true, false, true);
3422     }
3423     | U64IMAGE2DMSARRAY {
3424         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3425         $$.basicType = EbtSampler;
3426         $$.sampler.setImage(EbtUint64, Esd2D, true, false, true);
3427     }
3428     | SAMPLEREXTERNALOES {  // GL_OES_EGL_image_external
3429         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3430         $$.basicType = EbtSampler;
3431         $$.sampler.set(EbtFloat, Esd2D);
3432         $$.sampler.external = true;
3433     }
3434     | SAMPLEREXTERNAL2DY2YEXT { // GL_EXT_YUV_target
3435         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3436         $$.basicType = EbtSampler;
3437         $$.sampler.set(EbtFloat, Esd2D);
3438         $$.sampler.yuv = true;
3439     }
3440     | SUBPASSINPUT {
3441         parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3442         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3443         $$.basicType = EbtSampler;
3444         $$.sampler.setSubpass(EbtFloat);
3445     }
3446     | SUBPASSINPUTMS {
3447         parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3448         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3449         $$.basicType = EbtSampler;
3450         $$.sampler.setSubpass(EbtFloat, true);
3451     }
3452     | F16SUBPASSINPUT {
3453         parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
3454         parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3455         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3456         $$.basicType = EbtSampler;
3457         $$.sampler.setSubpass(EbtFloat16);
3458     }
3459     | F16SUBPASSINPUTMS {
3460         parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
3461         parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3462         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3463         $$.basicType = EbtSampler;
3464         $$.sampler.setSubpass(EbtFloat16, true);
3465     }
3466     | ISUBPASSINPUT {
3467         parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3468         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3469         $$.basicType = EbtSampler;
3470         $$.sampler.setSubpass(EbtInt);
3471     }
3472     | ISUBPASSINPUTMS {
3473         parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3474         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3475         $$.basicType = EbtSampler;
3476         $$.sampler.setSubpass(EbtInt, true);
3477     }
3478     | USUBPASSINPUT {
3479         parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3480         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3481         $$.basicType = EbtSampler;
3482         $$.sampler.setSubpass(EbtUint);
3483     }
3484     | USUBPASSINPUTMS {
3485         parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3486         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3487         $$.basicType = EbtSampler;
3488         $$.sampler.setSubpass(EbtUint, true);
3489     }
3490     | FCOOPMATNV {
3491         parseContext.fcoopmatCheck($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3492         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3493         $$.basicType = EbtFloat;
3494         $$.coopmat = true;
3495     }
3496     | ICOOPMATNV {
3497         parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3498         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3499         $$.basicType = EbtInt;
3500         $$.coopmat = true;
3501     }
3502     | UCOOPMATNV {
3503         parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3504         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3505         $$.basicType = EbtUint;
3506         $$.coopmat = true;
3507     }
3508     | spirv_type_specifier {
3509         parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier");
3510         $$ = $1;
3511     }
3512 GLSLANG_WEB_EXCLUDE_OFF
3513     | struct_specifier {
3514         $$ = $1;
3515         $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3516         parseContext.structTypeCheck($$.loc, $$);
3517     }
3518     | TYPE_NAME {
3519         //
3520         // This is for user defined type names.  The lexical phase looked up the
3521         // type.
3522         //
3523         if (const TVariable* variable = ($1.symbol)->getAsVariable()) {
3524             const TType& structure = variable->getType();
3525             $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3526             $$.basicType = EbtStruct;
3527             $$.userDef = &structure;
3528         } else
3529             parseContext.error($1.loc, "expected type name", $1.string->c_str(), "");
3530     }
3531     ;
3532
3533 precision_qualifier
3534     : HIGH_PRECISION {
3535         parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "highp precision qualifier");
3536         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3537         parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqHigh);
3538     }
3539     | MEDIUM_PRECISION {
3540         parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "mediump precision qualifier");
3541         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3542         parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqMedium);
3543     }
3544     | LOW_PRECISION {
3545         parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "lowp precision qualifier");
3546         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3547         parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqLow);
3548     }
3549     ;
3550
3551 struct_specifier
3552     : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
3553         TType* structure = new TType($5, *$2.string);
3554         parseContext.structArrayCheck($2.loc, *structure);
3555         TVariable* userTypeDef = new TVariable($2.string, *structure, true);
3556         if (! parseContext.symbolTable.insert(*userTypeDef))
3557             parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct");
3558         $$.init($1.loc);
3559         $$.basicType = EbtStruct;
3560         $$.userDef = structure;
3561         --parseContext.structNestingLevel;
3562     }
3563     | STRUCT LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
3564         TType* structure = new TType($4, TString(""));
3565         $$.init($1.loc);
3566         $$.basicType = EbtStruct;
3567         $$.userDef = structure;
3568         --parseContext.structNestingLevel;
3569     }
3570     ;
3571
3572 struct_declaration_list
3573     : struct_declaration {
3574         $$ = $1;
3575     }
3576     | struct_declaration_list struct_declaration {
3577         $$ = $1;
3578         for (unsigned int i = 0; i < $2->size(); ++i) {
3579             for (unsigned int j = 0; j < $$->size(); ++j) {
3580                 if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName())
3581                     parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str());
3582             }
3583             $$->push_back((*$2)[i]);
3584         }
3585     }
3586     ;
3587
3588 struct_declaration
3589     : type_specifier struct_declarator_list SEMICOLON {
3590         if ($1.arraySizes) {
3591             parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
3592             parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
3593             if (parseContext.isEsProfile())
3594                 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
3595         }
3596
3597         $$ = $2;
3598
3599         parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType);
3600         parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier);
3601
3602         for (unsigned int i = 0; i < $$->size(); ++i) {
3603             TType type($1);
3604             type.setFieldName((*$$)[i].type->getFieldName());
3605             type.transferArraySizes((*$$)[i].type->getArraySizes());
3606             type.copyArrayInnerSizes($1.arraySizes);
3607             parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
3608             (*$$)[i].type->shallowCopy(type);
3609         }
3610     }
3611     | type_qualifier type_specifier struct_declarator_list SEMICOLON {
3612         if ($2.arraySizes) {
3613             parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
3614             parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
3615             if (parseContext.isEsProfile())
3616                 parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes);
3617         }
3618
3619         $$ = $3;
3620
3621         parseContext.memberQualifierCheck($1);
3622         parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType);
3623         parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
3624         parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
3625
3626         for (unsigned int i = 0; i < $$->size(); ++i) {
3627             TType type($2);
3628             type.setFieldName((*$$)[i].type->getFieldName());
3629             type.transferArraySizes((*$$)[i].type->getArraySizes());
3630             type.copyArrayInnerSizes($2.arraySizes);
3631             parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
3632             (*$$)[i].type->shallowCopy(type);
3633         }
3634     }
3635     ;
3636
3637 struct_declarator_list
3638     : struct_declarator {
3639         $$ = new TTypeList;
3640         $$->push_back($1);
3641     }
3642     | struct_declarator_list COMMA struct_declarator {
3643         $$->push_back($3);
3644     }
3645     ;
3646
3647 struct_declarator
3648     : IDENTIFIER {
3649         $$.type = new TType(EbtVoid);
3650         $$.loc = $1.loc;
3651         $$.type->setFieldName(*$1.string);
3652     }
3653     | IDENTIFIER array_specifier {
3654         parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes);
3655
3656         $$.type = new TType(EbtVoid);
3657         $$.loc = $1.loc;
3658         $$.type->setFieldName(*$1.string);
3659         $$.type->transferArraySizes($2.arraySizes);
3660     }
3661     ;
3662
3663 initializer
3664     : assignment_expression {
3665         $$ = $1;
3666     }
3667 GLSLANG_WEB_EXCLUDE_ON
3668     | LEFT_BRACE initializer_list RIGHT_BRACE {
3669         const char* initFeature = "{ } style initializers";
3670         parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
3671         parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
3672         $$ = $2;
3673     }
3674     | LEFT_BRACE initializer_list COMMA RIGHT_BRACE {
3675         const char* initFeature = "{ } style initializers";
3676         parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
3677         parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
3678         $$ = $2;
3679     }
3680     | LEFT_BRACE RIGHT_BRACE {
3681         const char* initFeature = "empty { } initializer";
3682         parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_null_initializer, initFeature);
3683         parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature);
3684         $$ = parseContext.intermediate.makeAggregate($1.loc);
3685     }
3686 GLSLANG_WEB_EXCLUDE_OFF
3687     ;
3688
3689 GLSLANG_WEB_EXCLUDE_ON
3690 initializer_list
3691     : initializer {
3692         $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
3693     }
3694     | initializer_list COMMA initializer {
3695         $$ = parseContext.intermediate.growAggregate($1, $3);
3696     }
3697     ;
3698 GLSLANG_WEB_EXCLUDE_OFF
3699
3700 declaration_statement
3701     : declaration { $$ = $1; }
3702     ;
3703
3704 statement
3705     : compound_statement  { $$ = $1; }
3706     | simple_statement    { $$ = $1; }
3707     ;
3708
3709 // Grammar Note:  labeled statements for switch statements only; 'goto' is not supported.
3710
3711 simple_statement
3712     : declaration_statement { $$ = $1; }
3713     | expression_statement  { $$ = $1; }
3714     | selection_statement   { $$ = $1; }
3715     | switch_statement      { $$ = $1; }
3716     | case_label            { $$ = $1; }
3717     | iteration_statement   { $$ = $1; }
3718     | jump_statement        { $$ = $1; }
3719 GLSLANG_WEB_EXCLUDE_ON
3720     | demote_statement      { $$ = $1; }
3721 GLSLANG_WEB_EXCLUDE_OFF
3722     ;
3723
3724 GLSLANG_WEB_EXCLUDE_ON
3725 demote_statement
3726     : DEMOTE SEMICOLON {
3727         parseContext.requireStage($1.loc, EShLangFragment, "demote");
3728         parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote");
3729         $$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc);
3730     }
3731     ;
3732 GLSLANG_WEB_EXCLUDE_OFF
3733
3734 compound_statement
3735     : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
3736     | LEFT_BRACE {
3737         parseContext.symbolTable.push();
3738         ++parseContext.statementNestingLevel;
3739     }
3740       statement_list {
3741         parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3742         --parseContext.statementNestingLevel;
3743     }
3744       RIGHT_BRACE {
3745         if ($3 && $3->getAsAggregate())
3746             $3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
3747         $$ = $3;
3748     }
3749     ;
3750
3751 statement_no_new_scope
3752     : compound_statement_no_new_scope { $$ = $1; }
3753     | simple_statement                { $$ = $1; }
3754     ;
3755
3756 statement_scoped
3757     : {
3758         ++parseContext.controlFlowNestingLevel;
3759     }
3760       compound_statement  {
3761         --parseContext.controlFlowNestingLevel;
3762         $$ = $2;
3763     }
3764     | {
3765         parseContext.symbolTable.push();
3766         ++parseContext.statementNestingLevel;
3767         ++parseContext.controlFlowNestingLevel;
3768     }
3769       simple_statement {
3770         parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3771         --parseContext.statementNestingLevel;
3772         --parseContext.controlFlowNestingLevel;
3773         $$ = $2;
3774     }
3775
3776 compound_statement_no_new_scope
3777     // Statement that doesn't create a new scope, for selection_statement, iteration_statement
3778     : LEFT_BRACE RIGHT_BRACE {
3779         $$ = 0;
3780     }
3781     | LEFT_BRACE statement_list RIGHT_BRACE {
3782         if ($2 && $2->getAsAggregate())
3783             $2->getAsAggregate()->setOperator(EOpSequence);
3784         $$ = $2;
3785     }
3786     ;
3787
3788 statement_list
3789     : statement {
3790         $$ = parseContext.intermediate.makeAggregate($1);
3791         if ($1 && $1->getAsBranchNode() && ($1->getAsBranchNode()->getFlowOp() == EOpCase ||
3792                                             $1->getAsBranchNode()->getFlowOp() == EOpDefault)) {
3793             parseContext.wrapupSwitchSubsequence(0, $1);
3794             $$ = 0;  // start a fresh subsequence for what's after this case
3795         }
3796     }
3797     | statement_list statement {
3798         if ($2 && $2->getAsBranchNode() && ($2->getAsBranchNode()->getFlowOp() == EOpCase ||
3799                                             $2->getAsBranchNode()->getFlowOp() == EOpDefault)) {
3800             parseContext.wrapupSwitchSubsequence($1 ? $1->getAsAggregate() : 0, $2);
3801             $$ = 0;  // start a fresh subsequence for what's after this case
3802         } else
3803             $$ = parseContext.intermediate.growAggregate($1, $2);
3804     }
3805     ;
3806
3807 expression_statement
3808     : SEMICOLON  { $$ = 0; }
3809     | expression SEMICOLON  { $$ = static_cast<TIntermNode*>($1); }
3810     ;
3811
3812 selection_statement
3813     : selection_statement_nonattributed {
3814         $$ = $1;
3815     }
3816 GLSLANG_WEB_EXCLUDE_ON
3817     | attribute selection_statement_nonattributed {
3818         parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
3819         parseContext.handleSelectionAttributes(*$1, $2);
3820         $$ = $2;
3821     }
3822 GLSLANG_WEB_EXCLUDE_OFF
3823
3824 selection_statement_nonattributed
3825     : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
3826         parseContext.boolCheck($1.loc, $3);
3827         $$ = parseContext.intermediate.addSelection($3, $5, $1.loc);
3828     }
3829     ;
3830
3831 selection_rest_statement
3832     : statement_scoped ELSE statement_scoped {
3833         $$.node1 = $1;
3834         $$.node2 = $3;
3835     }
3836     | statement_scoped {
3837         $$.node1 = $1;
3838         $$.node2 = 0;
3839     }
3840     ;
3841
3842 condition
3843     // In 1996 c++ draft, conditions can include single declarations
3844     : expression {
3845         $$ = $1;
3846         parseContext.boolCheck($1->getLoc(), $1);
3847     }
3848     | fully_specified_type IDENTIFIER EQUAL initializer {
3849         parseContext.boolCheck($2.loc, $1);
3850
3851         TType type($1);
3852         TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
3853         if (initNode)
3854             $$ = initNode->getAsTyped();
3855         else
3856             $$ = 0;
3857     }
3858     ;
3859
3860 switch_statement
3861     : switch_statement_nonattributed {
3862         $$ = $1;
3863     }
3864 GLSLANG_WEB_EXCLUDE_ON
3865     | attribute switch_statement_nonattributed {
3866         parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
3867         parseContext.handleSwitchAttributes(*$1, $2);
3868         $$ = $2;
3869     }
3870 GLSLANG_WEB_EXCLUDE_OFF
3871
3872 switch_statement_nonattributed
3873     : SWITCH LEFT_PAREN expression RIGHT_PAREN {
3874         // start new switch sequence on the switch stack
3875         ++parseContext.controlFlowNestingLevel;
3876         ++parseContext.statementNestingLevel;
3877         parseContext.switchSequenceStack.push_back(new TIntermSequence);
3878         parseContext.switchLevel.push_back(parseContext.statementNestingLevel);
3879         parseContext.symbolTable.push();
3880     }
3881     LEFT_BRACE switch_statement_list RIGHT_BRACE {
3882         $$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0);
3883         delete parseContext.switchSequenceStack.back();
3884         parseContext.switchSequenceStack.pop_back();
3885         parseContext.switchLevel.pop_back();
3886         parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3887         --parseContext.statementNestingLevel;
3888         --parseContext.controlFlowNestingLevel;
3889     }
3890     ;
3891
3892 switch_statement_list
3893     : /* nothing */ {
3894         $$ = 0;
3895     }
3896     | statement_list {
3897         $$ = $1;
3898     }
3899     ;
3900
3901 case_label
3902     : CASE expression COLON {
3903         $$ = 0;
3904         if (parseContext.switchLevel.size() == 0)
3905             parseContext.error($1.loc, "cannot appear outside switch statement", "case", "");
3906         else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
3907             parseContext.error($1.loc, "cannot be nested inside control flow", "case", "");
3908         else {
3909             parseContext.constantValueCheck($2, "case");
3910             parseContext.integerCheck($2, "case");
3911             $$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc);
3912         }
3913     }
3914     | DEFAULT COLON {
3915         $$ = 0;
3916         if (parseContext.switchLevel.size() == 0)
3917             parseContext.error($1.loc, "cannot appear outside switch statement", "default", "");
3918         else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
3919             parseContext.error($1.loc, "cannot be nested inside control flow", "default", "");
3920         else
3921             $$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc);
3922     }
3923     ;
3924
3925 iteration_statement
3926     : iteration_statement_nonattributed {
3927         $$ = $1;
3928     }
3929 GLSLANG_WEB_EXCLUDE_ON
3930     | attribute iteration_statement_nonattributed {
3931         parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
3932         parseContext.handleLoopAttributes(*$1, $2);
3933         $$ = $2;
3934     }
3935 GLSLANG_WEB_EXCLUDE_OFF
3936
3937 iteration_statement_nonattributed
3938     : WHILE LEFT_PAREN {
3939         if (! parseContext.limits.whileLoops)
3940             parseContext.error($1.loc, "while loops not available", "limitation", "");
3941         parseContext.symbolTable.push();
3942         ++parseContext.loopNestingLevel;
3943         ++parseContext.statementNestingLevel;
3944         ++parseContext.controlFlowNestingLevel;
3945     }
3946       condition RIGHT_PAREN statement_no_new_scope {
3947         parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3948         $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc);
3949         --parseContext.loopNestingLevel;
3950         --parseContext.statementNestingLevel;
3951         --parseContext.controlFlowNestingLevel;
3952     }
3953     | DO {
3954         parseContext.symbolTable.push();
3955         ++parseContext.loopNestingLevel;
3956         ++parseContext.statementNestingLevel;
3957         ++parseContext.controlFlowNestingLevel;
3958     }
3959       statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
3960         if (! parseContext.limits.whileLoops)
3961             parseContext.error($1.loc, "do-while loops not available", "limitation", "");
3962
3963         parseContext.boolCheck($8.loc, $6);
3964
3965         $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc);
3966         parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3967         --parseContext.loopNestingLevel;
3968         --parseContext.statementNestingLevel;
3969         --parseContext.controlFlowNestingLevel;
3970     }
3971     | FOR LEFT_PAREN {
3972         parseContext.symbolTable.push();
3973         ++parseContext.loopNestingLevel;
3974         ++parseContext.statementNestingLevel;
3975         ++parseContext.controlFlowNestingLevel;
3976     }
3977       for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
3978         parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3979         $$ = parseContext.intermediate.makeAggregate($4, $2.loc);
3980         TIntermLoop* forLoop = parseContext.intermediate.addLoop($7, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), true, $1.loc);
3981         if (! parseContext.limits.nonInductiveForLoops)
3982             parseContext.inductiveLoopCheck($1.loc, $4, forLoop);
3983         $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc);
3984         $$->getAsAggregate()->setOperator(EOpSequence);
3985         --parseContext.loopNestingLevel;
3986         --parseContext.statementNestingLevel;
3987         --parseContext.controlFlowNestingLevel;
3988     }
3989     ;
3990
3991 for_init_statement
3992     : expression_statement {
3993         $$ = $1;
3994     }
3995     | declaration_statement {
3996         $$ = $1;
3997     }
3998     ;
3999
4000 conditionopt
4001     : condition {
4002         $$ = $1;
4003     }
4004     | /* May be null */ {
4005         $$ = 0;
4006     }
4007     ;
4008
4009 for_rest_statement
4010     : conditionopt SEMICOLON {
4011         $$.node1 = $1;
4012         $$.node2 = 0;
4013     }
4014     | conditionopt SEMICOLON expression  {
4015         $$.node1 = $1;
4016         $$.node2 = $3;
4017     }
4018     ;
4019
4020 jump_statement
4021     : CONTINUE SEMICOLON {
4022         if (parseContext.loopNestingLevel <= 0)
4023             parseContext.error($1.loc, "continue statement only allowed in loops", "", "");
4024         $$ = parseContext.intermediate.addBranch(EOpContinue, $1.loc);
4025     }
4026     | BREAK SEMICOLON {
4027         if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0)
4028             parseContext.error($1.loc, "break statement only allowed in switch and loops", "", "");
4029         $$ = parseContext.intermediate.addBranch(EOpBreak, $1.loc);
4030     }
4031     | RETURN SEMICOLON {
4032         $$ = parseContext.intermediate.addBranch(EOpReturn, $1.loc);
4033         if (parseContext.currentFunctionType->getBasicType() != EbtVoid)
4034             parseContext.error($1.loc, "non-void function must return a value", "return", "");
4035         if (parseContext.inMain)
4036             parseContext.postEntryPointReturn = true;
4037     }
4038     | RETURN expression SEMICOLON {
4039         $$ = parseContext.handleReturnValue($1.loc, $2);
4040     }
4041     | DISCARD SEMICOLON {
4042         parseContext.requireStage($1.loc, EShLangFragment, "discard");
4043         $$ = parseContext.intermediate.addBranch(EOpKill, $1.loc);
4044     }
4045     | TERMINATE_INVOCATION SEMICOLON {
4046         parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation");
4047         $$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc);
4048     }
4049 GLSLANG_WEB_EXCLUDE_ON
4050     | TERMINATE_RAY SEMICOLON {
4051         parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT");
4052         $$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc);
4053     }
4054     | IGNORE_INTERSECTION SEMICOLON {
4055         parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT");
4056         $$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc);
4057     }
4058 GLSLANG_WEB_EXCLUDE_OFF
4059     ;
4060
4061 // Grammar Note:  No 'goto'.  Gotos are not supported.
4062
4063 translation_unit
4064     : external_declaration {
4065         $$ = $1;
4066         parseContext.intermediate.setTreeRoot($$);
4067     }
4068     | translation_unit external_declaration {
4069         if ($2 != nullptr) {
4070             $$ = parseContext.intermediate.growAggregate($1, $2);
4071             parseContext.intermediate.setTreeRoot($$);
4072         }
4073     }
4074     ;
4075
4076 external_declaration
4077     : function_definition {
4078         $$ = $1;
4079     }
4080     | declaration {
4081         $$ = $1;
4082     }
4083 GLSLANG_WEB_EXCLUDE_ON
4084     | SEMICOLON {
4085         parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
4086         parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
4087         $$ = nullptr;
4088     }
4089 GLSLANG_WEB_EXCLUDE_OFF
4090     ;
4091
4092 function_definition
4093     : function_prototype {
4094         $1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */);
4095         $1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function);
4096
4097         // For ES 100 only, according to ES shading language 100 spec: A function
4098         // body has a scope nested inside the function's definition.
4099         if (parseContext.profile == EEsProfile && parseContext.version == 100)
4100         {
4101             parseContext.symbolTable.push();
4102             ++parseContext.statementNestingLevel;
4103         }
4104     }
4105     compound_statement_no_new_scope {
4106         //   May be best done as post process phase on intermediate code
4107         if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue)
4108             parseContext.error($1.loc, "function does not return a value:", "", $1.function->getName().c_str());
4109         parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
4110         $$ = parseContext.intermediate.growAggregate($1.intermNode, $3);
4111         parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.function->getType(), $1.loc);
4112         $$->getAsAggregate()->setName($1.function->getMangledName().c_str());
4113
4114         // store the pragma information for debug and optimize and other vendor specific
4115         // information. This information can be queried from the parse tree
4116         $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
4117         $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
4118         $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable);
4119
4120         // Set currentFunctionType to empty pointer when goes outside of the function
4121         parseContext.currentFunctionType = nullptr;
4122
4123         // For ES 100 only, according to ES shading language 100 spec: A function
4124         // body has a scope nested inside the function's definition.
4125         if (parseContext.profile == EEsProfile && parseContext.version == 100)
4126         {
4127             parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
4128             --parseContext.statementNestingLevel;
4129         }
4130     }
4131     ;
4132
4133 GLSLANG_WEB_EXCLUDE_ON
4134 attribute
4135     : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET {
4136         $$ = $3;
4137     }
4138
4139 attribute_list
4140     : single_attribute {
4141         $$ = $1;
4142     }
4143     | attribute_list COMMA single_attribute {
4144         $$ = parseContext.mergeAttributes($1, $3);
4145     }
4146
4147 single_attribute
4148     : IDENTIFIER {
4149         $$ = parseContext.makeAttributes(*$1.string);
4150     }
4151     | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN {
4152         $$ = parseContext.makeAttributes(*$1.string, $3);
4153     }
4154 GLSLANG_WEB_EXCLUDE_OFF
4155
4156 GLSLANG_WEB_EXCLUDE_ON
4157 spirv_requirements_list
4158     : spirv_requirements_parameter {
4159         $$ = $1;
4160     }
4161     | spirv_requirements_list COMMA spirv_requirements_parameter {
4162         $$ = parseContext.mergeSpirvRequirements($2.loc, $1, $3);
4163     }
4164
4165 spirv_requirements_parameter
4166     : IDENTIFIER EQUAL LEFT_BRACKET spirv_extension_list RIGHT_BRACKET {
4167         $$ = parseContext.makeSpirvRequirement($2.loc, *$1.string, $4->getAsAggregate(), nullptr);
4168     }
4169     | IDENTIFIER EQUAL LEFT_BRACKET spirv_capability_list RIGHT_BRACKET {
4170         $$ = parseContext.makeSpirvRequirement($2.loc, *$1.string, nullptr, $4->getAsAggregate());
4171     }
4172
4173 spirv_extension_list
4174     : STRING_LITERAL {
4175         $$ = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion($1.string, $1.loc, true));
4176     }
4177     | spirv_extension_list COMMA STRING_LITERAL {
4178         $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.string, $3.loc, true));
4179     }
4180
4181 spirv_capability_list
4182     : INTCONSTANT {
4183         $$ = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion($1.i, $1.loc, true));
4184     }
4185     | spirv_capability_list COMMA INTCONSTANT {
4186         $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.i, $3.loc, true));
4187     }
4188
4189 spirv_execution_mode_qualifier
4190     : SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT RIGHT_PAREN {
4191         parseContext.intermediate.insertSpirvExecutionMode($3.i);
4192         $$ = 0;
4193     }
4194     | SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN {
4195         parseContext.intermediate.insertSpirvRequirement($3);
4196         parseContext.intermediate.insertSpirvExecutionMode($5.i);
4197         $$ = 0;
4198     }
4199     | SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN {
4200         parseContext.intermediate.insertSpirvExecutionMode($3.i, $5->getAsAggregate());
4201         $$ = 0;
4202     }
4203     | SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN {
4204         parseContext.intermediate.insertSpirvRequirement($3);
4205         parseContext.intermediate.insertSpirvExecutionMode($5.i, $7->getAsAggregate());
4206         $$ = 0;
4207     }
4208     | SPIRV_EXECUTION_MODE_ID LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN {
4209         parseContext.intermediate.insertSpirvExecutionModeId($3.i, $5->getAsAggregate());
4210         $$ = 0;
4211     }
4212     | SPIRV_EXECUTION_MODE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN {
4213         parseContext.intermediate.insertSpirvRequirement($3);
4214         parseContext.intermediate.insertSpirvExecutionModeId($5.i, $7->getAsAggregate());
4215         $$ = 0;
4216     }
4217
4218 spirv_execution_mode_parameter_list
4219     : spirv_execution_mode_parameter {
4220         $$ = parseContext.intermediate.makeAggregate($1);
4221     }
4222     | spirv_execution_mode_parameter_list COMMA spirv_execution_mode_parameter {
4223         $$ = parseContext.intermediate.growAggregate($1, $3);
4224     }
4225
4226 spirv_execution_mode_parameter
4227     : FLOATCONSTANT {
4228         $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
4229     }
4230     | INTCONSTANT {
4231         $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
4232     }
4233     | UINTCONSTANT {
4234         $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
4235     }
4236     | BOOLCONSTANT {
4237         $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
4238     }
4239     | STRING_LITERAL {
4240         $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true);
4241     }
4242
4243 spirv_execution_mode_id_parameter_list
4244     : constant_expression {
4245         if ($1->getBasicType() != EbtFloat &&
4246             $1->getBasicType() != EbtInt &&
4247             $1->getBasicType() != EbtUint &&
4248             $1->getBasicType() != EbtBool &&
4249             $1->getBasicType() != EbtString)
4250             parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), "");
4251         $$ = parseContext.intermediate.makeAggregate($1);
4252     }
4253     | spirv_execution_mode_id_parameter_list COMMA constant_expression {
4254         if ($3->getBasicType() != EbtFloat &&
4255             $3->getBasicType() != EbtInt &&
4256             $3->getBasicType() != EbtUint &&
4257             $3->getBasicType() != EbtBool &&
4258             $3->getBasicType() != EbtString)
4259             parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), "");
4260         $$ = parseContext.intermediate.growAggregate($1, $3);
4261     }
4262
4263 spirv_storage_class_qualifier
4264     : SPIRV_STORAGE_CLASS LEFT_PAREN INTCONSTANT RIGHT_PAREN {
4265         $$.init($1.loc);
4266         $$.qualifier.storage = EvqSpirvStorageClass;
4267         $$.qualifier.spirvStorageClass = $3.i;
4268     }
4269     | SPIRV_STORAGE_CLASS LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN {
4270         $$.init($1.loc);
4271         parseContext.intermediate.insertSpirvRequirement($3);
4272         $$.qualifier.storage = EvqSpirvStorageClass;
4273         $$.qualifier.spirvStorageClass = $5.i;
4274     }
4275
4276 spirv_decorate_qualifier
4277     : SPIRV_DECORATE LEFT_PAREN INTCONSTANT RIGHT_PAREN{
4278         $$.init($1.loc);
4279         $$.qualifier.setSpirvDecorate($3.i);
4280     }
4281     | SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN{
4282         $$.init($1.loc);
4283         parseContext.intermediate.insertSpirvRequirement($3);
4284         $$.qualifier.setSpirvDecorate($5.i);
4285     }
4286     | SPIRV_DECORATE LEFT_PAREN INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN {
4287         $$.init($1.loc);
4288         $$.qualifier.setSpirvDecorate($3.i, $5->getAsAggregate());
4289     }
4290     | SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN {
4291         $$.init($1.loc);
4292         parseContext.intermediate.insertSpirvRequirement($3);
4293         $$.qualifier.setSpirvDecorate($5.i, $7->getAsAggregate());
4294     }
4295     | SPIRV_DECORATE_ID LEFT_PAREN INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN {
4296         $$.init($1.loc);
4297         $$.qualifier.setSpirvDecorateId($3.i, $5->getAsAggregate());
4298     }
4299     | SPIRV_DECORATE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN {
4300         $$.init($1.loc);
4301         parseContext.intermediate.insertSpirvRequirement($3);
4302         $$.qualifier.setSpirvDecorateId($5.i, $7->getAsAggregate());
4303     }
4304     | SPIRV_DECORATE_STRING LEFT_PAREN INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN {
4305         $$.init($1.loc);
4306         $$.qualifier.setSpirvDecorateString($3.i, $5->getAsAggregate());
4307     }
4308     | SPIRV_DECORATE_STRING LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN {
4309         $$.init($1.loc);
4310         parseContext.intermediate.insertSpirvRequirement($3);
4311         $$.qualifier.setSpirvDecorateString($5.i, $7->getAsAggregate());
4312     }
4313
4314 spirv_decorate_parameter_list
4315     : spirv_decorate_parameter {
4316         $$ = parseContext.intermediate.makeAggregate($1);
4317     }
4318     | spirv_decorate_parameter_list COMMA spirv_decorate_parameter {
4319         $$ = parseContext.intermediate.growAggregate($1, $3);
4320     }
4321
4322 spirv_decorate_parameter
4323     : FLOATCONSTANT {
4324         $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
4325     }
4326     | INTCONSTANT {
4327         $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
4328     }
4329     | UINTCONSTANT {
4330         $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
4331     }
4332     | BOOLCONSTANT {
4333         $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
4334     }
4335
4336 spirv_decorate_id_parameter_list
4337     : constant_expression {
4338         if ($1->getBasicType() != EbtFloat &&
4339             $1->getBasicType() != EbtInt &&
4340             $1->getBasicType() != EbtUint &&
4341             $1->getBasicType() != EbtBool)
4342             parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), "");
4343         $$ = parseContext.intermediate.makeAggregate($1);
4344     }
4345     | spirv_decorate_id_parameter_list COMMA constant_expression {
4346         if ($3->getBasicType() != EbtFloat &&
4347             $3->getBasicType() != EbtInt &&
4348             $3->getBasicType() != EbtUint &&
4349             $3->getBasicType() != EbtBool)
4350             parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), "");
4351         $$ = parseContext.intermediate.growAggregate($1, $3);
4352     }
4353
4354 spirv_decorate_string_parameter_list
4355     : STRING_LITERAL {
4356         $$ = parseContext.intermediate.makeAggregate(
4357             parseContext.intermediate.addConstantUnion($1.string, $1.loc, true));
4358     }
4359     | spirv_decorate_string_parameter_list COMMA STRING_LITERAL {
4360         $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.string, $3.loc, true));
4361     }
4362
4363 spirv_type_specifier
4364     : SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN {
4365         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
4366         $$.setSpirvType(*$3, $5);
4367     }
4368     | SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN {
4369         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
4370         parseContext.intermediate.insertSpirvRequirement($3);
4371         $$.setSpirvType(*$5, $7);
4372     }
4373     | SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN {
4374         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
4375         $$.setSpirvType(*$3);
4376     }
4377     | SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN {
4378         $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
4379         parseContext.intermediate.insertSpirvRequirement($3);
4380         $$.setSpirvType(*$5);
4381     }
4382
4383 spirv_type_parameter_list
4384     : spirv_type_parameter {
4385         $$ = $1;
4386     }
4387     | spirv_type_parameter_list COMMA spirv_type_parameter {
4388         $$ = parseContext.mergeSpirvTypeParameters($1, $3);
4389     }
4390
4391 spirv_type_parameter
4392     : constant_expression {
4393         $$ = parseContext.makeSpirvTypeParameters($1->getLoc(), $1->getAsConstantUnion());
4394     }
4395
4396 spirv_instruction_qualifier
4397     : SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN {
4398         $$ = $3;
4399     }
4400     | SPIRV_INSTRUCTION LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN {
4401         parseContext.intermediate.insertSpirvRequirement($3);
4402         $$ = $5;
4403     }
4404
4405 spirv_instruction_qualifier_list
4406     : spirv_instruction_qualifier_id {
4407         $$ = $1;
4408     }
4409     | spirv_instruction_qualifier_list COMMA spirv_instruction_qualifier_id {
4410         $$ = parseContext.mergeSpirvInstruction($2.loc, $1, $3);
4411     }
4412
4413 spirv_instruction_qualifier_id
4414     : IDENTIFIER EQUAL STRING_LITERAL {
4415         $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, *$3.string);
4416     }
4417     | IDENTIFIER EQUAL INTCONSTANT {
4418         $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i);
4419     }
4420 GLSLANG_WEB_EXCLUDE_OFF
4421
4422 %%