/* A Bison parser, made from glslang.y with Bison version GNU Bison version 1.24 */ #define YYBISON 1 /* Identify Bison output. */ #define ATTRIBUTE 258 #define CONST_QUAL 259 #define BOOL_TYPE 260 #define FLOAT_TYPE 261 #define INT_TYPE 262 #define BREAK 263 #define CONTINUE 264 #define DO 265 #define ELSE 266 #define FOR 267 #define IF 268 #define DISCARD 269 #define RETURN 270 #define BVEC2 271 #define BVEC3 272 #define BVEC4 273 #define IVEC2 274 #define IVEC3 275 #define IVEC4 276 #define VEC2 277 #define VEC3 278 #define VEC4 279 #define MATRIX2 280 #define MATRIX3 281 #define MATRIX4 282 #define IN_QUAL 283 #define OUT_QUAL 284 #define INOUT_QUAL 285 #define UNIFORM 286 #define VARYING 287 #define STRUCT 288 #define VOID_TYPE 289 #define WHILE 290 #define SAMPLER1D 291 #define SAMPLER2D 292 #define SAMPLER3D 293 #define SAMPLERCUBE 294 #define SAMPLER1DSHADOW 295 #define SAMPLER2DSHADOW 296 #define IDENTIFIER 297 #define TYPE_NAME 298 #define FLOATCONSTANT 299 #define INTCONSTANT 300 #define BOOLCONSTANT 301 #define FIELD_SELECTION 302 #define LEFT_OP 303 #define RIGHT_OP 304 #define INC_OP 305 #define DEC_OP 306 #define LE_OP 307 #define GE_OP 308 #define EQ_OP 309 #define NE_OP 310 #define AND_OP 311 #define OR_OP 312 #define XOR_OP 313 #define MUL_ASSIGN 314 #define DIV_ASSIGN 315 #define ADD_ASSIGN 316 #define MOD_ASSIGN 317 #define LEFT_ASSIGN 318 #define RIGHT_ASSIGN 319 #define AND_ASSIGN 320 #define XOR_ASSIGN 321 #define OR_ASSIGN 322 #define SUB_ASSIGN 323 #define LEFT_PAREN 324 #define RIGHT_PAREN 325 #define LEFT_BRACKET 326 #define RIGHT_BRACKET 327 #define LEFT_BRACE 328 #define RIGHT_BRACE 329 #define DOT 330 #define COMMA 331 #define COLON 332 #define EQUAL 333 #define SEMICOLON 334 #define BANG 335 #define DASH 336 #define TILDE 337 #define PLUS 338 #define STAR 339 #define SLASH 340 #define PERCENT 341 #define LEFT_ANGLE 342 #define RIGHT_ANGLE 343 #define VERTICAL_BAR 344 #define CARET 345 #define AMPERSAND 346 #define QUESTION 347 #line 39 "glslang.y" /* Based on: ANSI C Yacc grammar In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a matching Lex specification) for the April 30, 1985 draft version of the ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that original, as mentioned in the answer to question 17.25 of the comp.lang.c FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z. I intend to keep this version as close to the current C Standard grammar as possible; please let me know if you discover discrepancies. Jutta Degener, 1995 */ #include "SymbolTable.h" #include "ParseHelper.h" #include "../Public/ShaderLang.h" #ifdef _WIN32 #define YYPARSE_PARAM parseContext #define YYPARSE_PARAM_DECL TParseContext& #define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext) #define YYLEX_PARAM parseContext #else #define YYPARSE_PARAM parseContextLocal #define parseContext (*((TParseContext*)(parseContextLocal))) #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal) #define YYLEX_PARAM (void*)(parseContextLocal) extern void yyerror(char*); #endif #define FRAG_VERT_ONLY(S, L) { \ if (parseContext.language != EShLangFragment && \ parseContext.language != EShLangVertex) { \ parseContext.error(L, " supported in vertex/fragment shaders only ", S, "", ""); \ parseContext.recover(); \ } \ } #define VERTEX_ONLY(S, L) { \ if (parseContext.language != EShLangVertex) { \ parseContext.error(L, " supported in vertex shaders only ", S, "", ""); \ parseContext.recover(); \ } \ } #define FRAG_ONLY(S, L) { \ if (parseContext.language != EShLangFragment) { \ parseContext.error(L, " supported in fragment shaders only ", S, "", ""); \ parseContext.recover(); \ } \ } #define PACK_ONLY(S, L) { \ if (parseContext.language != EShLangPack) { \ parseContext.error(L, " supported in pack shaders only ", S, "", ""); \ parseContext.recover(); \ } \ } #define UNPACK_ONLY(S, L) { \ if (parseContext.language != EShLangUnpack) { \ parseContext.error(L, " supported in unpack shaders only ", S, "", ""); \ parseContext.recover(); \ } \ } #define PACK_UNPACK_ONLY(S, L) { \ if (parseContext.language != EShLangUnpack && \ parseContext.language != EShLangPack) { \ parseContext.error(L, " supported in pack/unpack shaders only ", S, "", ""); \ parseContext.recover(); \ } \ } #line 117 "glslang.y" typedef union { struct { TSourceLoc line; union { TString *string; float f; int i; bool b; }; TSymbol* symbol; } lex; struct { TSourceLoc line; TOperator op; union { TIntermNode* intermNode; TIntermNodePair nodePair; TIntermTyped* intermTypedNode; TIntermAggregate* intermAggregate; }; union { TPublicType type; TQualifier qualifier; TFunction* function; TParameter param; TTypeLine typeLine; TTypeList* typeList; }; } interm; } YYSTYPE; #line 148 "glslang.y" #ifndef _WIN32 extern int yylex(YYSTYPE*, void*); #endif #ifndef YYLTYPE typedef struct yyltype { int timestamp; int first_line; int first_column; int last_line; int last_column; char *text; } yyltype; #define YYLTYPE yyltype #endif #ifndef YYDEBUG #define YYDEBUG 1 #endif #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define YYFINAL 331 #define YYFLAG -32768 #define YYNTBASE 93 #define YYTRANSLATE(x) ((unsigned)(x) <= 347 ? yytranslate[x] : 167) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 2, 4, 6, 8, 10, 14, 16, 21, 23, 27, 30, 33, 35, 37, 40, 43, 46, 48, 51, 55, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 99, 102, 105, 107, 109, 111, 113, 115, 119, 123, 127, 129, 133, 137, 139, 143, 147, 149, 153, 157, 161, 165, 167, 171, 175, 177, 181, 183, 187, 189, 193, 195, 199, 201, 205, 207, 211, 213, 219, 221, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 253, 255, 258, 261, 264, 266, 268, 271, 275, 279, 282, 288, 292, 295, 299, 302, 303, 305, 307, 309, 311, 316, 318, 322, 328, 335, 341, 343, 346, 351, 357, 362, 364, 367, 369, 371, 373, 375, 377, 379, 381, 383, 385, 387, 389, 391, 393, 395, 397, 399, 401, 403, 405, 407, 409, 411, 413, 415, 417, 419, 421, 423, 429, 434, 436, 439, 443, 445, 449, 451, 456, 458, 460, 462, 464, 466, 468, 470, 472, 474, 477, 478, 479, 485, 487, 489, 492, 496, 498, 501, 503, 506, 512, 516, 518, 520, 525, 526, 533, 534, 543, 544, 552, 554, 556, 558, 559, 562, 566, 569, 572, 575, 579, 582, 584, 587, 589, 591, 592 }; static const short yyrhs[] = { 42, 0, 93, 0, 45, 0, 44, 0, 46, 0, 69, 120, 70, 0, 94, 0, 95, 71, 96, 72, 0, 97, 0, 95, 75, 47, 0, 95, 50, 0, 95, 51, 0, 120, 0, 98, 0, 100, 70, 0, 99, 70, 0, 101, 34, 0, 101, 0, 101, 118, 0, 100, 76, 118, 0, 102, 69, 0, 103, 0, 42, 0, 6, 0, 7, 0, 5, 0, 22, 0, 23, 0, 24, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 25, 0, 26, 0, 27, 0, 43, 0, 95, 0, 50, 104, 0, 51, 104, 0, 105, 104, 0, 83, 0, 81, 0, 80, 0, 82, 0, 104, 0, 106, 84, 104, 0, 106, 85, 104, 0, 106, 86, 104, 0, 106, 0, 107, 83, 106, 0, 107, 81, 106, 0, 107, 0, 108, 48, 107, 0, 108, 49, 107, 0, 108, 0, 109, 87, 108, 0, 109, 88, 108, 0, 109, 52, 108, 0, 109, 53, 108, 0, 109, 0, 110, 54, 109, 0, 110, 55, 109, 0, 110, 0, 111, 91, 110, 0, 111, 0, 112, 90, 111, 0, 112, 0, 113, 89, 112, 0, 113, 0, 114, 56, 113, 0, 114, 0, 115, 58, 114, 0, 115, 0, 116, 57, 115, 0, 116, 0, 116, 92, 120, 77, 117, 0, 117, 0, 104, 119, 118, 0, 78, 0, 59, 0, 60, 0, 62, 0, 61, 0, 68, 0, 63, 0, 64, 0, 65, 0, 66, 0, 67, 0, 118, 0, 120, 76, 118, 0, 117, 0, 123, 79, 0, 131, 79, 0, 124, 70, 0, 126, 0, 125, 0, 126, 128, 0, 125, 76, 128, 0, 133, 42, 69, 0, 135, 42, 0, 135, 42, 71, 121, 72, 0, 134, 129, 127, 0, 129, 127, 0, 134, 129, 130, 0, 129, 130, 0, 0, 28, 0, 29, 0, 30, 0, 135, 0, 135, 71, 121, 72, 0, 132, 0, 131, 76, 42, 0, 131, 76, 42, 71, 72, 0, 131, 76, 42, 71, 121, 72, 0, 131, 76, 42, 78, 141, 0, 133, 0, 133, 42, 0, 133, 42, 71, 72, 0, 133, 42, 71, 121, 72, 0, 133, 42, 78, 141, 0, 135, 0, 134, 135, 0, 4, 0, 3, 0, 32, 0, 31, 0, 34, 0, 6, 0, 7, 0, 5, 0, 22, 0, 23, 0, 24, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 25, 0, 26, 0, 27, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 136, 0, 43, 0, 33, 42, 73, 137, 74, 0, 33, 73, 137, 74, 0, 138, 0, 137, 138, 0, 135, 139, 79, 0, 140, 0, 139, 76, 140, 0, 42, 0, 42, 71, 121, 72, 0, 118, 0, 122, 0, 145, 0, 144, 0, 142, 0, 151, 0, 152, 0, 155, 0, 162, 0, 73, 74, 0, 0, 0, 73, 146, 150, 147, 74, 0, 149, 0, 144, 0, 73, 74, 0, 73, 150, 74, 0, 143, 0, 150, 143, 0, 79, 0, 120, 79, 0, 13, 69, 120, 70, 153, 0, 143, 11, 143, 0, 143, 0, 120, 0, 133, 42, 78, 141, 0, 0, 35, 69, 156, 154, 70, 148, 0, 0, 10, 157, 143, 35, 69, 120, 70, 79, 0, 0, 12, 69, 158, 159, 161, 70, 148, 0, 151, 0, 142, 0, 154, 0, 0, 160, 79, 0, 160, 79, 120, 0, 9, 79, 0, 8, 79, 0, 15, 79, 0, 15, 120, 79, 0, 14, 79, 0, 164, 0, 163, 164, 0, 165, 0, 122, 0, 0, 123, 166, 149, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, 210, 244, 247, 260, 265, 270, 276, 279, 347, 350, 459, 469, 482, 490, 585, 589, 596, 600, 607, 613, 622, 628, 639, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 680, 683, 693, 703, 725, 726, 727, 728, 734, 735, 744, 753, 765, 766, 774, 785, 786, 795, 807, 808, 818, 828, 838, 851, 852, 862, 875, 876, 888, 889, 901, 902, 914, 915, 928, 929, 942, 943, 956, 957, 971, 972, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 999, 1002, 1010, 1018, 1019, 1027, 1063, 1066, 1073, 1081, 1102, 1120, 1131, 1158, 1163, 1173, 1178, 1188, 1191, 1194, 1197, 1203, 1208, 1226, 1229, 1237, 1245, 1253, 1275, 1279, 1288, 1297, 1306, 1396, 1399, 1416, 1420, 1427, 1435, 1444, 1449, 1454, 1459, 1470, 1475, 1480, 1485, 1490, 1495, 1500, 1505, 1510, 1515, 1521, 1527, 1533, 1539, 1545, 1551, 1557, 1563, 1569, 1574, 1587, 1597, 1605, 1608, 1623, 1641, 1645, 1651, 1656, 1672, 1676, 1680, 1681, 1687, 1688, 1689, 1690, 1691, 1695, 1696, 1696, 1696, 1704, 1705, 1710, 1713, 1721, 1724, 1730, 1731, 1735, 1743, 1747, 1757, 1762, 1779, 1779, 1784, 1784, 1791, 1791, 1804, 1807, 1813, 1816, 1822, 1826, 1833, 1840, 1847, 1854, 1865, 1874, 1878, 1885, 1888, 1894, 1979 }; static const char * const yytname[] = { "$","error","$undefined.","ATTRIBUTE", "CONST_QUAL","BOOL_TYPE","FLOAT_TYPE","INT_TYPE","BREAK","CONTINUE","DO","ELSE", "FOR","IF","DISCARD","RETURN","BVEC2","BVEC3","BVEC4","IVEC2","IVEC3","IVEC4", "VEC2","VEC3","VEC4","MATRIX2","MATRIX3","MATRIX4","IN_QUAL","OUT_QUAL","INOUT_QUAL", "UNIFORM","VARYING","STRUCT","VOID_TYPE","WHILE","SAMPLER1D","SAMPLER2D","SAMPLER3D", "SAMPLERCUBE","SAMPLER1DSHADOW","SAMPLER2DSHADOW","IDENTIFIER","TYPE_NAME","FLOATCONSTANT", "INTCONSTANT","BOOLCONSTANT","FIELD_SELECTION","LEFT_OP","RIGHT_OP","INC_OP", "DEC_OP","LE_OP","GE_OP","EQ_OP","NE_OP","AND_OP","OR_OP","XOR_OP","MUL_ASSIGN", "DIV_ASSIGN","ADD_ASSIGN","MOD_ASSIGN","LEFT_ASSIGN","RIGHT_ASSIGN","AND_ASSIGN", "XOR_ASSIGN","OR_ASSIGN","SUB_ASSIGN","LEFT_PAREN","RIGHT_PAREN","LEFT_BRACKET", "RIGHT_BRACKET","LEFT_BRACE","RIGHT_BRACE","DOT","COMMA","COLON","EQUAL","SEMICOLON", "BANG","DASH","TILDE","PLUS","STAR","SLASH","PERCENT","LEFT_ANGLE","RIGHT_ANGLE", "VERTICAL_BAR","CARET","AMPERSAND","QUESTION","variable_identifier","primary_expression", "postfix_expression","integer_expression","function_call","function_call_generic", "function_call_header_no_parameters","function_call_header_with_parameters", "function_call_header","function_identifier","constructor_identifier","unary_expression", "unary_operator","multiplicative_expression","additive_expression","shift_expression", "relational_expression","equality_expression","and_expression","exclusive_or_expression", "inclusive_or_expression","logical_and_expression","logical_xor_expression", "logical_or_expression","conditional_expression","assignment_expression","assignment_operator", "expression","constant_expression","declaration","function_prototype","function_declarator", "function_header_with_parameters","function_header","parameter_declarator","parameter_declaration", "parameter_qualifier","parameter_type_specifier","init_declarator_list","single_declaration", "fully_specified_type","type_qualifier","type_specifier","struct_specifier", "struct_declaration_list","struct_declaration","struct_declarator_list","struct_declarator", "initializer","declaration_statement","statement","simple_statement","compound_statement", "@1","@2","statement_no_new_scope","compound_statement_no_new_scope","statement_list", "expression_statement","selection_statement","selection_rest_statement","condition", "iteration_statement","@3","@4","@5","for_init_statement","conditionopt","for_rest_statement", "jump_statement","translation_unit","external_declaration","function_definition", "@6","" }; #endif static const short yyr1[] = { 0, 93, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 96, 97, 98, 98, 99, 99, 100, 100, 101, 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 105, 105, 105, 105, 106, 106, 106, 106, 107, 107, 107, 108, 108, 108, 109, 109, 109, 109, 109, 110, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 125, 126, 127, 127, 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 131, 131, 131, 131, 131, 132, 132, 132, 132, 132, 133, 133, 134, 134, 134, 134, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, 142, 143, 143, 144, 144, 144, 144, 144, 145, 146, 147, 145, 148, 148, 149, 149, 150, 150, 151, 151, 152, 153, 153, 154, 154, 156, 155, 157, 155, 158, 155, 159, 159, 160, 160, 161, 161, 162, 162, 162, 162, 162, 163, 163, 164, 164, 166, 165 }; static const short yyr2[] = { 0, 1, 1, 1, 1, 1, 3, 1, 4, 1, 3, 2, 2, 1, 1, 2, 2, 2, 1, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, 2, 2, 1, 1, 2, 3, 3, 2, 5, 3, 2, 3, 2, 0, 1, 1, 1, 1, 4, 1, 3, 5, 6, 5, 1, 2, 4, 5, 4, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 4, 1, 2, 3, 1, 3, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 5, 1, 1, 2, 3, 1, 2, 1, 2, 5, 3, 1, 1, 4, 0, 6, 0, 8, 0, 7, 1, 1, 1, 0, 2, 3, 2, 2, 2, 3, 2, 1, 2, 1, 1, 0, 3 }; static const short yydefact[] = { 0, 129, 128, 135, 133, 134, 139, 140, 141, 142, 143, 144, 136, 137, 138, 145, 146, 147, 131, 130, 0, 132, 148, 149, 150, 151, 152, 153, 155, 211, 212, 0, 100, 110, 0, 116, 121, 0, 126, 154, 0, 208, 210, 0, 0, 96, 0, 98, 110, 111, 112, 113, 101, 0, 110, 0, 97, 122, 127, 209, 0, 0, 0, 158, 0, 213, 102, 107, 109, 114, 0, 117, 103, 0, 0, 0, 163, 0, 161, 157, 159, 135, 133, 134, 0, 0, 193, 0, 0, 0, 0, 139, 140, 141, 142, 143, 144, 136, 137, 138, 145, 146, 147, 0, 1, 155, 4, 3, 5, 0, 0, 0, 175, 180, 184, 46, 45, 47, 44, 2, 7, 40, 9, 14, 0, 0, 18, 0, 22, 48, 0, 52, 55, 58, 63, 66, 68, 70, 72, 74, 76, 78, 80, 93, 0, 166, 0, 169, 182, 168, 167, 0, 170, 171, 172, 173, 104, 0, 106, 108, 0, 0, 26, 24, 25, 30, 31, 32, 33, 34, 35, 27, 28, 29, 36, 37, 38, 39, 123, 48, 95, 0, 165, 125, 156, 0, 0, 160, 204, 203, 0, 195, 0, 207, 205, 0, 191, 41, 42, 0, 174, 0, 11, 12, 0, 0, 16, 15, 0, 17, 19, 21, 83, 84, 86, 85, 88, 89, 90, 91, 92, 87, 82, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 185, 181, 183, 0, 0, 118, 0, 120, 124, 0, 162, 0, 0, 0, 206, 0, 6, 176, 0, 13, 10, 20, 81, 49, 50, 51, 54, 53, 56, 57, 61, 62, 59, 60, 64, 65, 67, 69, 71, 73, 75, 77, 0, 94, 0, 115, 119, 164, 0, 198, 197, 200, 0, 189, 0, 0, 0, 8, 0, 105, 0, 199, 0, 0, 188, 186, 0, 0, 177, 79, 0, 201, 0, 0, 0, 179, 192, 178, 0, 202, 196, 187, 190, 194, 0, 0 }; static const short yydefgoto[] = { 119, 120, 121, 264, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 223, 144, 181, 145, 146, 31, 32, 33, 67, 52, 53, 68, 34, 35, 36, 37, 38, 39, 62, 63, 77, 78, 183, 147, 148, 149, 150, 201, 302, 322, 323, 151, 152, 153, 311, 301, 154, 261, 190, 258, 297, 308, 309, 155, 40, 41, 42, 46 }; static const short yypact[] = { 1130, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -31, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -36, -43, 8, 4, -50,-32768, 38, 1169,-32768,-32768, 197, -32768,-32768, 21, 1169,-32768, 58,-32768, 35,-32768,-32768, -32768,-32768, 1169, 69, 93,-32768, -54,-32768,-32768, 1169, 94, 1047,-32768, 257,-32768,-32768,-32768,-32768, -20, 1169, -3,-32768, 707, 979, 1086, 66, -21,-32768,-32768,-32768, 70, 71, 72, 59, 63,-32768, 75, 76, 67, 775, 78, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 95, 96, 97, 98,-32768,-32768,-32768, 979, 979, 979, 117,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 10,-32768,-32768, 92, 0, 843, 99,-32768, 55, 979, 24, -12, 53, -40, 51, 79, 73, 104, 138, 140, -39,-32768,-32768, 7,-32768, -36,-32768,-32768,-32768,-32768, 338,-32768,-32768,-32768,-32768, 128, 979,-32768,-32768, 911, 979,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 133,-32768,-32768,-32768, 979, 94,-32768,-32768,-32768, 419, -32768, 979,-32768,-32768, 17,-32768,-32768,-32768, 2,-32768, 419,-32768,-32768, 979, 159,-32768,-32768, 979,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768, 979,-32768, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, 979,-32768,-32768,-32768, 979, 135, -32768, 136,-32768,-32768, 137,-32768, 175, 571, 3,-32768, 639,-32768, 419, 139, 149,-32768,-32768,-32768,-32768,-32768, -32768, 24, 24, -12, -12, 53, 53, 53, 53, -40, -40, 51, 79, 73, 104, 138, 140, 48,-32768, 154, -32768,-32768,-32768, 158,-32768,-32768, 639, 419, 149, 190, 169, 167,-32768, 979,-32768, 979,-32768, 163, 173, 233, -32768, 171, 500,-32768,-32768, 12, 979, 500, 419, 979, -32768,-32768,-32768, 166, 149,-32768,-32768,-32768,-32768, 250, -32768 }; static const short yypgoto[] = {-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -53,-32768, -117, -104, -143, -107, 14, 15, 13, 18, 16, 42,-32768, -57, -74,-32768, -49, -154, 5, 9, -32768,-32768,-32768, 185, 208, 232, 217,-32768,-32768, -247, -29, -16,-32768, 244, -52,-32768, 119, -159, 52, -150, -288,-32768,-32768,-32768, -9, 260, 110, 54,-32768,-32768, 19,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 273,-32768,-32768 }; #define YYLAST 1212 static const short yytable[] = { 182, 248, 253, 250, 54, 29, 252, 1, 2, 30, 80, 43, 232, 233, 300, 72, 180, 73, 243, 54, 179, 58, 156, 80, 74, 321, 55, 47, 61, 56, 321, 255, 49, 50, 51, 18, 19, 69, 1, 2, 257, 195, 44, 45, 61, 29, 61, 234, 235, 30, 300, 157, 210, 244, 69, 186, 197, 198, 187, 61, 202, 203, 199, 49, 50, 51, 18, 19, 160, 228, 207, 229, 262, 298, -99, 161, 208, 224, 245, 245, 57, 204, 324, 245, 48, 205, 246, 182, 245, 276, 277, 278, 279, 245, 60, 290, 260, 49, 50, 51, 180, 230, 231, 180, 179, 236, 237, 179, 225, 226, 227, 272, 273, 248, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 245, 304, 274, 275, 180, 280, 281, 64, 179, 222, 267, 71, 76, 185, 188, -26, -24, -25, 189, 259, 191, 192, 193, -30, 310, 268, -31, -32, -33, -34, -35, 265, -27, -28, -29, -36, -37, 328, 206, 239, -38, 196, -23, -39, 211, 327, 238, 289, 269, 270, 271, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 200, 180, 240, 241, 288, 179, 330, 242, 249, 1, 2, 3, 4, 5, 254, 266, 291, 292, 293, 294, 303, 299, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 245, 305, 306, 18, 19, 20, 21, 312, 22, 23, 24, 25, 26, 27, 313, 28, 314, 317, 318, 319, 329, 182, 315, 299, 320, 331, 179, 282, 284, 283, 158, 66, 316, 286, 285, 1, 2, 81, 82, 83, 84, 85, 86, 325, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 287, 70, 159, 18, 19, 20, 21, 103, 22, 23, 24, 25, 26, 27, 104, 105, 106, 107, 108, 75, 256, 65, 109, 110, 326, 295, 263, 296, 59, 0, 0, 307, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, 118, 1, 2, 81, 82, 83, 84, 85, 86, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, 0, 0, 18, 19, 20, 21, 103, 22, 23, 24, 25, 26, 27, 104, 105, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 112, 247, 0, 0, 0, 0, 114, 115, 116, 117, 118, 1, 2, 81, 82, 83, 84, 85, 86, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, 0, 0, 18, 19, 20, 21, 103, 22, 23, 24, 25, 26, 27, 104, 105, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 112, 0, 0, 0, 0, 0, 114, 115, 116, 117, 118, 1, 2, 81, 82, 83, 84, 85, 86, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, 0, 0, 18, 19, 20, 21, 103, 22, 23, 24, 25, 26, 27, 104, 105, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 64, 1, 2, 81, 82, 83, 114, 115, 116, 117, 118, 0, 0, 0, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, 0, 0, 18, 19, 20, 21, 0, 22, 23, 24, 25, 26, 27, 104, 105, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 1, 2, 81, 82, 83, 0, 0, 0, 114, 115, 116, 117, 118, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 0, 0, 0, 18, 19, 20, 21, 0, 22, 23, 24, 25, 26, 27, 104, 105, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 162, 163, 164, 0, 0, 0, 0, 115, 116, 117, 118, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 177, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 178, 162, 163, 164, 0, 0, 0, 0, 115, 116, 117, 118, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 177, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 162, 163, 164, 0, 0, 0, 194, 115, 116, 117, 118, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 0, 0, 0, 0, 0, 0, 209, 0, 0, 0, 0, 0, 0, 0, 104, 177, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 162, 163, 164, 0, 0, 0, 0, 115, 116, 117, 118, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 177, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 251, 162, 163, 164, 0, 0, 0, 0, 115, 116, 117, 118, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 177, 106, 107, 108, 0, 0, 0, 109, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 3, 4, 5, 0, 0, 0, 0, 115, 116, 117, 118, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, 20, 21, 0, 22, 23, 24, 25, 26, 27, 0, 28, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, 20, 21, 79, 22, 23, 24, 25, 26, 27, 0, 28, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 184, 18, 19, 20, 21, 0, 22, 23, 24, 25, 26, 27, 0, 28, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, 20, 21, 0, 22, 23, 24, 25, 26, 27, 0, 28 }; static const short yycheck[] = { 74, 151, 161, 157, 33, 0, 160, 3, 4, 0, 62, 42, 52, 53, 261, 69, 73, 71, 57, 48, 73, 37, 42, 75, 78, 313, 76, 70, 44, 79, 318, 185, 28, 29, 30, 31, 32, 53, 3, 4, 190, 90, 73, 79, 60, 40, 62, 87, 88, 40, 297, 71, 126, 92, 70, 76, 109, 110, 79, 75, 50, 51, 111, 28, 29, 30, 31, 32, 71, 81, 70, 83, 70, 70, 70, 78, 76, 130, 76, 76, 42, 71, 70, 76, 76, 75, 79, 161, 76, 232, 233, 234, 235, 76, 73, 249, 79, 28, 29, 30, 157, 48, 49, 160, 157, 54, 55, 160, 84, 85, 86, 228, 229, 263, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 76, 77, 230, 231, 185, 236, 237, 73, 185, 78, 208, 42, 42, 71, 79, 69, 69, 69, 79, 192, 69, 69, 79, 69, 298, 223, 69, 69, 69, 69, 69, 204, 69, 69, 69, 69, 69, 320, 70, 90, 69, 69, 69, 69, 69, 319, 91, 245, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 74, 249, 89, 56, 244, 249, 0, 58, 71, 3, 4, 5, 6, 7, 72, 47, 72, 72, 72, 35, 72, 261, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 76, 72, 69, 31, 32, 33, 34, 42, 36, 37, 38, 39, 40, 41, 70, 43, 74, 79, 70, 11, 79, 320, 304, 297, 78, 0, 304, 238, 240, 239, 70, 48, 306, 242, 241, 3, 4, 5, 6, 7, 8, 9, 10, 317, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 243, 54, 70, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 60, 186, 46, 50, 51, 318, 258, 201, 258, 40, -1, -1, 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, 73, 74, -1, -1, -1, -1, 79, 80, 81, 82, 83, 3, 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, 73, 74, -1, -1, -1, -1, 79, 80, 81, 82, 83, 3, 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, 73, -1, -1, -1, -1, -1, 79, 80, 81, 82, 83, 3, 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, 73, 3, 4, 5, 6, 7, 79, 80, 81, 82, 83, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, 31, 32, 33, 34, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, 3, 4, 5, 6, 7, -1, -1, -1, 79, 80, 81, 82, 83, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, 31, 32, 33, 34, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, 5, 6, 7, -1, -1, -1, -1, 80, 81, 82, 83, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, 72, 5, 6, 7, -1, -1, -1, -1, 80, 81, 82, 83, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, 5, 6, 7, -1, -1, -1, 79, 80, 81, 82, 83, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, 5, 6, 7, -1, -1, -1, -1, 80, 81, 82, 83, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, 72, 5, 6, 7, -1, -1, -1, -1, 80, 81, 82, 83, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, 45, 46, -1, -1, -1, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, 5, 6, 7, -1, -1, -1, -1, 80, 81, 82, 83, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, 33, 34, -1, 36, 37, 38, 39, 40, 41, -1, 43, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, 33, 34, 74, 36, 37, 38, 39, 40, 41, -1, 43, -1, -1, -1, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, 74, 31, 32, 33, 34, -1, 36, 37, 38, 39, 40, 41, -1, 43, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, 33, 34, -1, 36, 37, 38, 39, 40, 41, -1, 43 }; #define YYPURE 1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not __GNUC__ */ #if HAVE_ALLOCA_H #include #else /* not HAVE_ALLOCA_H */ #ifdef _AIX #pragma alloca #else /* not _AIX */ char *alloca (); #endif /* not _AIX */ #endif /* not HAVE_ALLOCA_H */ #endif /* not __GNUC__ */ extern void yyerror(char* s); #ifndef alloca #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) #include #else /* not sparc */ #if (defined (MSDOS) && !defined (__TURBOC__)) || defined (WIN32) #include #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) #include #pragma alloca #else /* not MSDOS, __TURBOC__, or _AIX */ #ifdef __hpux #ifdef __cplusplus extern "C" { void *alloca (unsigned int); }; #else /* not __cplusplus */ void *alloca (); #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc. */ #endif /* not GNU C. */ #endif /* alloca not defined. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT return(0) #define YYABORT return(1) #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 #ifndef YYPURE #define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else #define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef YYPURE int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */ #ifdef YYLSP_NEEDED YYLTYPE yylloc; /* location data for the lookahead */ /* symbol */ #endif int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* YYINITDEPTH indicates the initial size of the parser's stacks */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ int yyparse (void); #endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (from, to, count) char *from; char *to; size_t count; { register char *f = from; register char *t = to; register size_t i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (char *from, char *to, size_t count) { register char *f = from; register char *t = to; register size_t i = count; while (i-- > 0) *t++ = *f++; } #endif #endif /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM #ifndef YYPARSE_PARAM_DECL #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; #endif #else #define YYPARSE_PARAM #define YYPARSE_PARAM_DECL #endif extern YY_DECL; int yyparse(YYPARSE_PARAM_DECL YYPARSE_PARAM) { register int yystate; register int yyn; register short *yyssp; register YYSTYPE *yyvsp; int yyerrstatus; /* number of tokens to shift before error messages enabled */ int yychar1 = 0; /* lookahead token as an internal (translated) token number */ short yyssa[YYINITDEPTH]; /* the state stack */ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ short *yyss = yyssa; /* refer to the stacks thru separate pointers */ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif size_t yystacksize = YYINITDEPTH; #ifdef YYPURE int yychar; YYSTYPE yylval; int yynerrs; #ifdef YYLSP_NEEDED YYLTYPE yylloc; #endif #endif YYSTYPE yyval; /* the variable used to return */ /* semantic values from the action */ /* routines */ int yylen; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Starting parse\n"); #endif yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss - 1; yyvsp = yyvs; #ifdef YYLSP_NEEDED yylsp = yyls; #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif /* Get the current used size of the three stacks, in elements. */ size_t size = yyssp - yyss + 1; #ifdef yyoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yyls1, size * sizeof (*yylsp), &yystacksize); #else yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); #ifdef YYLSP_NEEDED yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); #endif #endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; #ifdef YYLSP_NEEDED yylsp = yyls + size - 1; #endif #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate); #endif goto yybackup; yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: "); #endif yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef YYPRINT YYPRINT (stderr, yychar, yylval); #endif fprintf (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /* Do the default action for the current state. */ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */ #if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 1: #line 210 "glslang.y" { // The symbol table search was done in the lexical phase const TSymbol* symbol = yyvsp[0].lex.symbol; const TVariable* variable; if (symbol == 0) { parseContext.error(yyvsp[0].lex.line, "undeclared identifier", yyvsp[0].lex.string->c_str(), ""); parseContext.recover(); TVariable* fakeVariable = new TVariable(yyvsp[0].lex.string, TType(EbtFloat)); parseContext.symbolTable.insert(*fakeVariable); variable = fakeVariable; } else { // This identifier can only be a variable type symbol if (! symbol->isVariable()) { parseContext.error(yyvsp[0].lex.line, "variable expected", yyvsp[0].lex.string->c_str(), ""); parseContext.recover(); } variable = static_cast(symbol); } // don't delete $1.string, it's used by error recovery, and the pool // pop will reclaim the memory if (variable->getType().getQualifier() == EvqConst ) { constUnion* constArray = variable->getConstPointer(); TType t = TType(variable->getType()); yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(constArray, t, yyvsp[0].lex.line); } else yyval.interm.intermTypedNode = parseContext.intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), yyvsp[0].lex.line); ; break;} case 2: #line 244 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 3: #line 247 "glslang.y" { // // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders, // check for overflow for constants // if (abs(yyvsp[0].lex.i) >= (1 << 16)) { parseContext.error(yyvsp[0].lex.line, " integer constant overflow", "", ""); parseContext.recover(); } constUnion *unionArray = new constUnion[1]; unionArray->iConst = yyvsp[0].lex.i; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line); ; break;} case 4: #line 260 "glslang.y" { constUnion *unionArray = new constUnion[1]; unionArray->fConst = yyvsp[0].lex.f; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].lex.line); ; break;} case 5: #line 265 "glslang.y" { constUnion *unionArray = new constUnion[1]; unionArray->bConst = yyvsp[0].lex.b; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[0].lex.line); ; break;} case 6: #line 270 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode; ; break;} case 7: #line 276 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 8: #line 279 "glslang.y" { if (!yyvsp[-3].interm.intermTypedNode->isArray() && !yyvsp[-3].interm.intermTypedNode->isMatrix() && !yyvsp[-3].interm.intermTypedNode->isVector()) { if (yyvsp[-3].interm.intermTypedNode->getAsSymbolNode()) parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", yyvsp[-3].interm.intermTypedNode->getAsSymbolNode()->getSymbol().c_str(), ""); else parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", "expression", ""); parseContext.recover(); } if (yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst && !yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) { if (yyvsp[-3].interm.intermTypedNode->isVector()) { // constant folding for vectors TVectorFields fields; fields.num = 1; fields.offsets[0] = yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst; // need to do it this way because v.xy sends fields integer array yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line); } else if (yyvsp[-3].interm.intermTypedNode->isMatrix()) { // constant folding for matrices yyval.interm.intermTypedNode = parseContext.addConstMatrixNode(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line); } } else { if (yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) { if ((yyvsp[-3].interm.intermTypedNode->isVector() || yyvsp[-3].interm.intermTypedNode->isMatrix()) && yyvsp[-3].interm.intermTypedNode->getType().getNominalSize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst && !yyvsp[-3].interm.intermTypedNode->isArray() ) { parseContext.error(yyvsp[-2].lex.line, "", "[", "field selection out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst); parseContext.recover(); } else { if (yyvsp[-3].interm.intermTypedNode->isArray()) { if (yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) { if (yyvsp[-3].interm.intermTypedNode->getType().getMaxArraySize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst) { if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, true, yyvsp[-2].lex.line)) parseContext.recover(); } else { if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), 0, false, yyvsp[-2].lex.line)) parseContext.recover(); } } else if ( yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst >= yyvsp[-3].interm.intermTypedNode->getType().getArraySize()) { parseContext.error(yyvsp[-2].lex.line, "", "[", "array index out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst); parseContext.recover(); } } yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line); } } else { if (yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) { parseContext.error(yyvsp[-2].lex.line, "", "[", "array must be redeclared with a size before being indexed with a variable"); parseContext.recover(); } yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexIndirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line); } } if (yyval.interm.intermTypedNode == 0) { constUnion *unionArray = new constUnion[1]; unionArray->fConst = 0.0; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[-2].lex.line); } else if (yyvsp[-3].interm.intermTypedNode->isArray()) { if (yyvsp[-3].interm.intermTypedNode->getType().getStruct()) yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getType().getStruct(), yyvsp[-3].interm.intermTypedNode->getType().getTypeName())); else yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize(), yyvsp[-3].interm.intermTypedNode->isMatrix())); } else if (yyvsp[-3].interm.intermTypedNode->isMatrix() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst) yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst, yyvsp[-3].interm.intermTypedNode->getNominalSize())); else if (yyvsp[-3].interm.intermTypedNode->isMatrix()) yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize())); else if (yyvsp[-3].interm.intermTypedNode->isVector() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst) yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst)); else if (yyvsp[-3].interm.intermTypedNode->isVector()) yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary)); else yyval.interm.intermTypedNode->setType(yyvsp[-3].interm.intermTypedNode->getType()); ; break;} case 9: #line 347 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 10: #line 350 "glslang.y" { if (yyvsp[-2].interm.intermTypedNode->isArray()) { parseContext.error(yyvsp[0].lex.line, "cannot apply dot operator to an array", ".", ""); parseContext.recover(); } if (yyvsp[-2].interm.intermTypedNode->isVector()) { TVectorFields fields; if (! parseContext.parseVectorFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) { fields.num = 1; fields.offsets[0] = 0; parseContext.recover(); } if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) { // constant folding for vector fields yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-2].interm.intermTypedNode, yyvsp[0].lex.line); if (yyval.interm.intermTypedNode == 0) { parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } else yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqConst, (int) (*yyvsp[0].lex.string).size())); } else { if (fields.num == 1) { constUnion *unionArray = new constUnion[1]; unionArray->iConst = fields.offsets[0]; TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line); yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType())); } else { TString vectorString = *yyvsp[0].lex.string; TIntermTyped* index = parseContext.intermediate.addSwizzle(fields, yyvsp[0].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpVectorSwizzle, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line); yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(),EvqTemporary, (int) vectorString.size())); } } } else if (yyvsp[-2].interm.intermTypedNode->isMatrix()) { TMatrixFields fields; if (! parseContext.parseMatrixFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) { fields.wholeRow = false; fields.wholeCol = false; fields.row = 0; fields.col = 0; parseContext.recover(); } if (fields.wholeRow || fields.wholeCol) { parseContext.error(yyvsp[-1].lex.line, " non-scalar fields not implemented yet", ".", ""); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->iConst = 0; TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line); yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-2].interm.intermTypedNode->getNominalSize())); } else { constUnion *unionArray = new constUnion[1]; unionArray->iConst = fields.col * yyvsp[-2].interm.intermTypedNode->getNominalSize() + fields.row; TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line); yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType())); } } else if (yyvsp[-2].interm.intermTypedNode->getBasicType() == EbtStruct) { bool fieldFound = false; TTypeList* fields = yyvsp[-2].interm.intermTypedNode->getType().getStruct(); if (fields == 0) { parseContext.error(yyvsp[-1].lex.line, "structure has no fields", "Internal Error", ""); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } else { unsigned int i; for (i = 0; i < fields->size(); ++i) { if ((*fields)[i].type->getFieldName() == *yyvsp[0].lex.string) { fieldFound = true; break; } } if (fieldFound) { if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) { yyval.interm.intermTypedNode = parseContext.addConstStruct(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode, yyvsp[-1].lex.line); if (yyval.interm.intermTypedNode == 0) { parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } else { yyval.interm.intermTypedNode->setType(*(*fields)[i].type); // change the qualifier of the return type, not of the structure field // as the structure definition is shared between various structures. yyval.interm.intermTypedNode->getTypePointer()->changeQualifier(EvqConst); } } else { constUnion *unionArray = new constUnion[1]; unionArray->iConst = i; TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirectStruct, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line); yyval.interm.intermTypedNode->setType(*(*fields)[i].type); } } else { parseContext.error(yyvsp[-1].lex.line, " no such field in structure", yyvsp[0].lex.string->c_str(), ""); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } } } else { parseContext.error(yyvsp[-1].lex.line, " field selection requires structure, vector, or matrix on left hand side", yyvsp[0].lex.string->c_str(), ""); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } // don't delete $3.string, it's from the pool ; break;} case 11: #line 459 "glslang.y" { if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostIncrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.unaryOpError(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode; } ; break;} case 12: #line 469 "glslang.y" { if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostDecrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.unaryOpError(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode; } ; break;} case 13: #line 482 "glslang.y" { if (parseContext.integerErrorCheck(yyvsp[0].interm.intermTypedNode, "[]")) parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 14: #line 490 "glslang.y" { TFunction* fnCall = yyvsp[0].interm.function; TOperator op = fnCall->getBuiltInOp(); if (op != EOpNull) { // // Then this should be a constructor. // TType type(EbtVoid); // use this to get the type back if (parseContext.constructorErrorCheck(yyvsp[0].interm.line, yyvsp[0].interm.intermNode, *fnCall, op, &type)) { yyval.interm.intermTypedNode = 0; } else { // // It's a constructor, of type 'type'. // yyval.interm.intermTypedNode = parseContext.addConstructor(yyvsp[0].interm.intermNode, &type, op, fnCall, yyvsp[0].interm.line); } if (yyval.interm.intermTypedNode == 0) { parseContext.recover(); yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(0, op, yyvsp[0].interm.line); } yyval.interm.intermTypedNode->setType(type); } else { // // Not a constructor. Find it in the symbol table. // const TFunction* fnCandidate; bool builtIn; fnCandidate = parseContext.findFunction(yyvsp[0].interm.line, fnCall, &builtIn); if (fnCandidate) { // // A declared function. But, it might still map to a built-in // operation. // op = fnCandidate->getBuiltInOp(); if (builtIn && op != EOpNull) { // // A function call mapped to a built-in operation. // if (fnCandidate->getParamCount() == 1) { // // Treat it like a built-in unary operator. // yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(op, yyvsp[0].interm.intermNode, 0, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.error(yyvsp[0].interm.intermNode->getLine(), " wrong operand type", "Internal Error", "built in unary operator function. Type: %s", static_cast(yyvsp[0].interm.intermNode)->getCompleteString().c_str()); YYERROR; } } else { yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, op, yyvsp[0].interm.line); } } else { // This is a real function call yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, EOpFunctionCall, yyvsp[0].interm.line); yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType()); // this is how we know whether the given function is a builtIn function or a user defined function // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also // if builtIn == true, it's definitely a builtIn function with EOpNull if (!builtIn) yyval.interm.intermTypedNode->getAsAggregate()->setUserDefined(); yyval.interm.intermTypedNode->getAsAggregate()->setName(fnCandidate->getMangledName()); TQualifier qual; TQualifierList& qualifierList = yyval.interm.intermTypedNode->getAsAggregate()->getQualifier(); for (int i = 0; i < fnCandidate->getParamCount(); ++i) { qual = (*fnCandidate)[i].type->getQualifier(); if (qual == EvqOut || qual == EvqInOut) { if (parseContext.lValueErrorCheck(yyval.interm.intermTypedNode->getLine(), "assign", yyval.interm.intermTypedNode->getAsAggregate()->getSequence()[i]->getAsTyped())) { parseContext.error(yyvsp[0].interm.intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", ""); parseContext.recover(); } } qualifierList.push_back(qual); } } yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType()); } else { // error message was put out by PaFindFunction() // Put on a dummy node for error recovery constUnion *unionArray = new constUnion[1]; unionArray->fConst = 0.0; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].interm.line); parseContext.recover(); } } delete fnCall; ; break;} case 15: #line 585 "glslang.y" { yyval.interm = yyvsp[-1].interm; yyval.interm.line = yyvsp[0].lex.line; ; break;} case 16: #line 589 "glslang.y" { yyval.interm = yyvsp[-1].interm; yyval.interm.line = yyvsp[0].lex.line; ; break;} case 17: #line 596 "glslang.y" { yyval.interm.function = yyvsp[-1].interm.function; yyval.interm.intermNode = 0; ; break;} case 18: #line 600 "glslang.y" { yyval.interm.function = yyvsp[0].interm.function; yyval.interm.intermNode = 0; ; break;} case 19: #line 607 "glslang.y" { TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) }; yyvsp[-1].interm.function->addParameter(param); yyval.interm.function = yyvsp[-1].interm.function; yyval.interm.intermNode = yyvsp[0].interm.intermTypedNode; ; break;} case 20: #line 613 "glslang.y" { TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) }; yyvsp[-2].interm.function->addParameter(param); yyval.interm.function = yyvsp[-2].interm.function; yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line); ; break;} case 21: #line 622 "glslang.y" { yyval.interm.function = yyvsp[-1].interm.function; ; break;} case 22: #line 628 "glslang.y" { if (yyvsp[0].interm.op == EOpConstructStruct) { TString tempString = ""; TFunction *function = new TFunction(&tempString, *(yyvsp[0].interm.type.userDef), yyvsp[0].interm.op); yyval.interm.function = function; } else { TFunction *function = new TFunction(yyvsp[0].interm.op); yyval.interm.function = function; } ; break;} case 23: #line 639 "glslang.y" { if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string)) parseContext.recover(); TFunction *function = new TFunction(yyvsp[0].lex.string, TType(EbtVoid)); yyval.interm.function = function; ; break;} case 24: #line 654 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructFloat; ; break;} case 25: #line 655 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructInt; ; break;} case 26: #line 656 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBool; ; break;} case 27: #line 657 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec2; ; break;} case 28: #line 658 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec3; ; break;} case 29: #line 659 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec4; ; break;} case 30: #line 660 "glslang.y" { FRAG_VERT_ONLY("bvec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec2; ; break;} case 31: #line 661 "glslang.y" { FRAG_VERT_ONLY("bvec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec3; ; break;} case 32: #line 662 "glslang.y" { FRAG_VERT_ONLY("bvec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec4; ; break;} case 33: #line 663 "glslang.y" { FRAG_VERT_ONLY("ivec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec2; ; break;} case 34: #line 664 "glslang.y" { FRAG_VERT_ONLY("ivec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec3; ; break;} case 35: #line 665 "glslang.y" { FRAG_VERT_ONLY("ivec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec4; ; break;} case 36: #line 666 "glslang.y" { FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat2; ; break;} case 37: #line 667 "glslang.y" { FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat3; ; break;} case 38: #line 668 "glslang.y" { FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat4; ; break;} case 39: #line 669 "glslang.y" { TType& structure = static_cast(yyvsp[0].lex.symbol)->getType(); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line }; yyval.interm.type = t; yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructStruct; ; break;} case 40: #line 680 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 41: #line 683 "glslang.y" { if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreIncrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.unaryOpError(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; } ; break;} case 42: #line 693 "glslang.y" { if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreDecrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.unaryOpError(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; } ; break;} case 43: #line 703 "glslang.y" { if (yyvsp[-1].interm.op != EOpNull) { yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(yyvsp[-1].interm.op, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { char* errorOp = ""; switch(yyvsp[-1].interm.op) { case EOpNegative: errorOp = "-"; break; case EOpLogicalNot: errorOp = "!"; break; case EOpBitwiseNot: errorOp = "~"; break; default: break; } parseContext.unaryOpError(yyvsp[-1].interm.line, errorOp, yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; } } else yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 44: #line 725 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNull; ; break;} case 45: #line 726 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNegative; ; break;} case 46: #line 727 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLogicalNot; ; break;} case 47: #line 728 "glslang.y" { PACK_UNPACK_ONLY("~", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpBitwiseNot; ; break;} case 48: #line 734 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 49: #line 735 "glslang.y" { FRAG_VERT_ONLY("*", yyvsp[-1].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMul, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "*", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 50: #line 744 "glslang.y" { FRAG_VERT_ONLY("/", yyvsp[-1].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpDiv, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "/", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 51: #line 753 "glslang.y" { PACK_UNPACK_ONLY("%", yyvsp[-1].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMod, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "%", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 52: #line 765 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 53: #line 766 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAdd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "+", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 54: #line 774 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpSub, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "-", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 55: #line 785 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 56: #line 786 "glslang.y" { PACK_UNPACK_ONLY("<<", yyvsp[-1].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLeftShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "<<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 57: #line 795 "glslang.y" { PACK_UNPACK_ONLY(">>", yyvsp[-1].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpRightShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, ">>", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 58: #line 807 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 59: #line 808 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 60: #line 818 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, ">", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 61: #line 828 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "<=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 62: #line 838 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, ">=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 63: #line 851 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 64: #line 852 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "==", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 65: #line 862 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpNotEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "!=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 66: #line 875 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 67: #line 876 "glslang.y" { PACK_UNPACK_ONLY("&", yyvsp[-1].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 68: #line 888 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 69: #line 889 "glslang.y" { PACK_UNPACK_ONLY("^", yyvsp[-1].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpExclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 70: #line 901 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 71: #line 902 "glslang.y" { PACK_UNPACK_ONLY("|", yyvsp[-1].lex.line); yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpInclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "|", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 72: #line 914 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 73: #line 915 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "&&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 74: #line 928 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 75: #line 929 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalXor, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "^^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 76: #line 942 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 77: #line 943 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-1].lex.line, "||", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); constUnion *unionArray = new constUnion[1]; unionArray->bConst = false; yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line); } ; break;} case 78: #line 956 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 79: #line 957 "glslang.y" { if (parseContext.boolErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermTypedNode = parseContext.intermediate.addSelection(yyvsp[-4].interm.intermTypedNode, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-3].lex.line); if (yyval.interm.intermTypedNode == 0) { parseContext.binaryOpError(yyvsp[-3].lex.line, ":", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; } ; break;} case 80: #line 971 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 81: #line 972 "glslang.y" { if (parseContext.lValueErrorCheck(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermTypedNode = parseContext.intermediate.addAssign(yyvsp[-1].interm.op, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line); if (yyval.interm.intermTypedNode == 0) { parseContext.assignError(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString()); parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode; } ; break;} case 82: #line 985 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAssign; ; break;} case 83: #line 986 "glslang.y" { FRAG_VERT_ONLY("*=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpMulAssign; ; break;} case 84: #line 987 "glslang.y" { FRAG_VERT_ONLY("/=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpDivAssign; ; break;} case 85: #line 988 "glslang.y" { PACK_UNPACK_ONLY("%=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpModAssign; ; break;} case 86: #line 989 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAddAssign; ; break;} case 87: #line 990 "glslang.y" { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpSubAssign; ; break;} case 88: #line 991 "glslang.y" { PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLeftShiftAssign; ; break;} case 89: #line 992 "glslang.y" { PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpRightShiftAssign; ; break;} case 90: #line 993 "glslang.y" { PACK_UNPACK_ONLY("&=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAndAssign; ; break;} case 91: #line 994 "glslang.y" { PACK_UNPACK_ONLY("^=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpExclusiveOrAssign; ; break;} case 92: #line 995 "glslang.y" { PACK_UNPACK_ONLY("|=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpInclusiveOrAssign; ; break;} case 93: #line 999 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 94: #line 1002 "glslang.y" { yyval.interm.intermTypedNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line); yyval.interm.intermTypedNode->getAsAggregate()->setOperator(EOpComma); yyval.interm.intermTypedNode->setType(yyvsp[0].interm.intermTypedNode->getType()); ; break;} case 95: #line 1010 "glslang.y" { if (parseContext.constErrorCheck(yyvsp[0].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 96: #line 1018 "glslang.y" { yyval.interm.intermNode = 0; ; break;} case 97: #line 1019 "glslang.y" { if (yyvsp[-1].interm.intermAggregate) yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence); yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate; ; break;} case 98: #line 1027 "glslang.y" { // // Multiple declarations of the same function are allowed. // // If this is a definition, the definition production code will check for redefinitions // (we don't know at this point if it's a definition or not). // // Redeclarations are allowed. But, return types and parameter qualifiers must match. // TFunction* prevDec = static_cast(parseContext.symbolTable.find(yyvsp[-1].interm.function->getMangledName())); if (prevDec) { if (prevDec->getReturnType() != yyvsp[-1].interm.function->getReturnType()) { parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same return type", yyvsp[-1].interm.function->getReturnType().getBasicString(), ""); parseContext.recover(); } for (int i = 0; i < prevDec->getParamCount(); ++i) { if ((*prevDec)[i].type->getQualifier() != (*yyvsp[-1].interm.function)[i].type->getQualifier()) { parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same parameter qualifiers", (*yyvsp[-1].interm.function)[i].type->getQualifierString(), ""); parseContext.recover(); } } } // // If this is a redeclaration, it could also be a definition, // in which case, we want to use the variable names from this one, and not the one that's // being redeclared. So, pass back up this declaration, not the one in the symbol table. // yyval.interm.function = yyvsp[-1].interm.function; yyval.interm.line = yyvsp[0].lex.line; parseContext.symbolTable.insert(*yyval.interm.function); ; break;} case 99: #line 1063 "glslang.y" { yyval.interm.function = yyvsp[0].interm.function; ; break;} case 100: #line 1066 "glslang.y" { yyval.interm.function = yyvsp[0].interm.function; ; break;} case 101: #line 1073 "glslang.y" { // Add the parameter yyval.interm.function = yyvsp[-1].interm.function; if (yyvsp[0].interm.param.type->getBasicType() != EbtVoid) yyvsp[-1].interm.function->addParameter(yyvsp[0].interm.param); else delete yyvsp[0].interm.param.type; ; break;} case 102: #line 1081 "glslang.y" { // // Only first parameter of one-parameter functions can be void // The check for named parameters not being void is done in parameter_declarator // if (yyvsp[0].interm.param.type->getBasicType() == EbtVoid) { // // This parameter > first is void // parseContext.error(yyvsp[-1].lex.line, "cannot be an argument type except for '(void)'", "void", ""); parseContext.recover(); delete yyvsp[0].interm.param.type; } else { // Add the parameter yyval.interm.function = yyvsp[-2].interm.function; yyvsp[-2].interm.function->addParameter(yyvsp[0].interm.param); } ; break;} case 103: #line 1102 "glslang.y" { if (yyvsp[-2].interm.type.qualifier != EvqGlobal && yyvsp[-2].interm.type.qualifier != EvqTemporary) { parseContext.error(yyvsp[-1].lex.line, "no qualifiers allowed for function return", getQualifierString(yyvsp[-2].interm.type.qualifier), ""); parseContext.recover(); } // make sure a sampler is not involved as well... if (parseContext.structQualifierErrorCheck(yyvsp[-1].lex.line, yyvsp[-2].interm.type)) parseContext.recover(); // Add the function as a prototype after parsing it (we do not support recursion) TFunction *function; function = new TFunction(yyvsp[-1].lex.string, TType(yyvsp[-2].interm.type)); yyval.interm.function = function; ; break;} case 104: #line 1120 "glslang.y" { if (yyvsp[-1].interm.type.type == EbtVoid) { parseContext.error(yyvsp[0].lex.line, "illegal use of type 'void'", yyvsp[0].lex.string->c_str(), ""); parseContext.recover(); } if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string)) parseContext.recover(); TParameter param = {yyvsp[0].lex.string, new TType(yyvsp[-1].interm.type)}; yyval.interm.line = yyvsp[0].lex.line; yyval.interm.param = param; ; break;} case 105: #line 1131 "glslang.y" { // Check that we can make an array out of this type if (yyvsp[-4].interm.type.array) { parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-4].interm.type).getCompleteString().c_str(), ""); parseContext.recover(); } if (parseContext.reservedErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string)) parseContext.recover(); yyvsp[-4].interm.type.array = true; TType* type = new TType(yyvsp[-4].interm.type); if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()) type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst); TParameter param = { yyvsp[-3].lex.string, type }; yyval.interm.line = yyvsp[-3].lex.line; yyval.interm.param = param; ; break;} case 106: #line 1158 "glslang.y" { yyval.interm = yyvsp[0].interm; if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type)) parseContext.recover(); ; break;} case 107: #line 1163 "glslang.y" { yyval.interm = yyvsp[0].interm; if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type)) parseContext.recover(); if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type)) parseContext.recover(); ; break;} case 108: #line 1173 "glslang.y" { yyval.interm = yyvsp[0].interm; if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type)) parseContext.recover(); ; break;} case 109: #line 1178 "glslang.y" { yyval.interm = yyvsp[0].interm; if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type)) parseContext.recover(); if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type)) parseContext.recover(); ; break;} case 110: #line 1188 "glslang.y" { yyval.interm.qualifier = EvqIn; ; break;} case 111: #line 1191 "glslang.y" { yyval.interm.qualifier = EvqIn; ; break;} case 112: #line 1194 "glslang.y" { yyval.interm.qualifier = EvqOut; ; break;} case 113: #line 1197 "glslang.y" { yyval.interm.qualifier = EvqInOut; ; break;} case 114: #line 1203 "glslang.y" { TParameter param = { 0, new TType(yyvsp[0].interm.type) }; yyval.interm.param = param; ; break;} case 115: #line 1208 "glslang.y" { // Check that we can make an array out of this type if (yyvsp[-3].interm.type.array) { parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-3].interm.type).getCompleteString().c_str(), ""); parseContext.recover(); } yyvsp[-3].interm.type.array = true; TType* type = new TType(yyvsp[-3].interm.type); if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()) type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst); TParameter param = { 0, type }; yyval.interm.line = yyvsp[-2].lex.line; yyval.interm.param = param; ; break;} case 116: #line 1226 "glslang.y" { yyval.interm = yyvsp[0].interm; ; break;} case 117: #line 1229 "glslang.y" { yyval.interm = yyvsp[-2].interm; if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.type)) parseContext.recover(); if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type)) parseContext.recover(); ; break;} case 118: #line 1237 "glslang.y" { yyval.interm = yyvsp[-4].interm; if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type)) parseContext.recover(); if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0)) parseContext.recover(); ; break;} case 119: #line 1245 "glslang.y" { yyval.interm = yyvsp[-5].interm; if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-5].interm.type)) parseContext.recover(); if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode)) parseContext.recover(); ; break;} case 120: #line 1253 "glslang.y" { yyval.interm = yyvsp[-4].interm; if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type)) parseContext.recover(); TIntermNode* intermNode; if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-4].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) { // // build the intermediate representation // if (intermNode) yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-4].interm.intermNode, intermNode, yyvsp[-1].lex.line); else yyval.interm.intermAggregate = yyvsp[-4].interm.intermAggregate; } else { parseContext.recover(); yyval.interm.intermAggregate = 0; } ; break;} case 121: #line 1275 "glslang.y" { yyval.interm.type = yyvsp[0].interm.type; yyval.interm.intermAggregate = 0; ; break;} case 122: #line 1279 "glslang.y" { yyval.interm.intermAggregate = 0; yyval.interm.type = yyvsp[-1].interm.type; if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-1].interm.type)) parseContext.recover(); if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type)) parseContext.recover(); ; break;} case 123: #line 1288 "glslang.y" { yyval.interm.intermAggregate = 0; yyval.interm.type = yyvsp[-3].interm.type; if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type)) parseContext.recover(); if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0)) parseContext.recover(); ; break;} case 124: #line 1297 "glslang.y" { yyval.interm.intermAggregate = 0; yyval.interm.type = yyvsp[-4].interm.type; if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.type)) parseContext.recover(); if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode)) parseContext.recover(); ; break;} case 125: #line 1306 "glslang.y" { yyval.interm.type = yyvsp[-3].interm.type; if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type)) parseContext.recover(); TIntermNode* intermNode; if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) { // // Build intermediate representation // if (intermNode) yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, yyvsp[-1].lex.line); else yyval.interm.intermAggregate = 0; } else { parseContext.recover(); yyval.interm.intermAggregate = 0; } ; break;} case 126: #line 1396 "glslang.y" { yyval.interm.type = yyvsp[0].interm.type; ; break;} case 127: #line 1399 "glslang.y" { TPublicType t = { yyvsp[0].interm.type.type, yyvsp[-1].interm.type.qualifier, yyvsp[0].interm.type.size, yyvsp[0].interm.type.matrix, false, yyvsp[0].interm.type.userDef, 0 }; if (yyvsp[-1].interm.type.qualifier == EvqAttribute && (yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) { parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), ""); parseContext.recover(); } if ((yyvsp[-1].interm.type.qualifier == EvqVaryingIn || yyvsp[-1].interm.type.qualifier == EvqVaryingOut) && (yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) { parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), ""); parseContext.recover(); } yyval.interm.type = t; ; break;} case 128: #line 1416 "glslang.y" { TPublicType t = { EbtVoid, EvqConst, 1, false, false, 0 }; yyval.interm.type = t; ; break;} case 129: #line 1420 "glslang.y" { VERTEX_ONLY("attribute", yyvsp[0].lex.line); if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "attribute")) parseContext.recover(); TPublicType t = { EbtVoid, EvqAttribute, 1, false, false, 0 }; yyval.interm.type = t; ; break;} case 130: #line 1427 "glslang.y" { if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "varying")) parseContext.recover(); TPublicType t = { EbtVoid, EvqVaryingIn, 1, false, false, 0 }; if (parseContext.language == EShLangVertex) t.qualifier = EvqVaryingOut; yyval.interm.type = t; ; break;} case 131: #line 1435 "glslang.y" { if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "uniform")) parseContext.recover(); TPublicType t = { EbtVoid, EvqUniform, 1, false, false, 0 }; yyval.interm.type = t; ; break;} case 132: #line 1444 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtVoid, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 133: #line 1449 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtFloat, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 134: #line 1454 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtInt, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 135: #line 1459 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtBool, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 136: #line 1470 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtFloat, qual, 2, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 137: #line 1475 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtFloat, qual, 3, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 138: #line 1480 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtFloat, qual, 4, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 139: #line 1485 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtBool, qual, 2, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 140: #line 1490 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtBool, qual, 3, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 141: #line 1495 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtBool, qual, 4, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 142: #line 1500 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtInt, qual, 2, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 143: #line 1505 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtInt, qual, 3, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 144: #line 1510 "glslang.y" { TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtInt, qual, 4, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 145: #line 1515 "glslang.y" { FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtFloat, qual, 2, true, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 146: #line 1521 "glslang.y" { FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtFloat, qual, 3, true, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 147: #line 1527 "glslang.y" { FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtFloat, qual, 4, true, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 148: #line 1533 "glslang.y" { FRAG_VERT_ONLY("sampler1D", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtSampler1D, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 149: #line 1539 "glslang.y" { FRAG_VERT_ONLY("sampler2D", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtSampler2D, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 150: #line 1545 "glslang.y" { FRAG_VERT_ONLY("sampler3D", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtSampler3D, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 151: #line 1551 "glslang.y" { FRAG_VERT_ONLY("samplerCube", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtSamplerCube, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 152: #line 1557 "glslang.y" { FRAG_VERT_ONLY("sampler1DShadow", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtSampler1DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 153: #line 1563 "glslang.y" { FRAG_VERT_ONLY("sampler2DShadow", yyvsp[0].lex.line); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtSampler2DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 154: #line 1569 "glslang.y" { FRAG_VERT_ONLY("struct", yyvsp[0].interm.type.line); yyval.interm.type = yyvsp[0].interm.type; yyval.interm.type.qualifier = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; ; break;} case 155: #line 1574 "glslang.y" { // // This is for user defined type names. The lexical phase looked up the // type. // TType& structure = static_cast(yyvsp[0].lex.symbol)->getType(); TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line }; yyval.interm.type = t; ; break;} case 156: #line 1587 "glslang.y" { TType* structure = new TType(yyvsp[-1].interm.typeList, *yyvsp[-3].lex.string); TVariable* userTypeDef = new TVariable(yyvsp[-3].lex.string, *structure, true); if (! parseContext.symbolTable.insert(*userTypeDef)) { parseContext.error(yyvsp[-3].lex.line, "redefinition", yyvsp[-3].lex.string->c_str(), "struct"); parseContext.recover(); } TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-4].lex.line }; yyval.interm.type = t; ; break;} case 157: #line 1597 "glslang.y" { TType* structure = new TType(yyvsp[-1].interm.typeList, TString("")); TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-3].lex.line }; yyval.interm.type = t; ; break;} case 158: #line 1605 "glslang.y" { yyval.interm.typeList = yyvsp[0].interm.typeList; ; break;} case 159: #line 1608 "glslang.y" { yyval.interm.typeList = yyvsp[-1].interm.typeList; for (unsigned int i = 0; i < yyvsp[0].interm.typeList->size(); ++i) { for (unsigned int j = 0; j < yyval.interm.typeList->size(); ++j) { if ((*yyval.interm.typeList)[j].type->getFieldName() == (*yyvsp[0].interm.typeList)[i].type->getFieldName()) { parseContext.error((*yyvsp[0].interm.typeList)[i].line, "duplicate field name in structure:", "struct", (*yyvsp[0].interm.typeList)[i].type->getFieldName().c_str()); parseContext.recover(); } } yyval.interm.typeList->push_back((*yyvsp[0].interm.typeList)[i]); } ; break;} case 160: #line 1623 "glslang.y" { yyval.interm.typeList = yyvsp[-1].interm.typeList; if (parseContext.voidErrorCheck(yyvsp[-2].interm.type.line, (*yyvsp[-1].interm.typeList)[0].type->getFieldName(), yyvsp[-2].interm.type)) { parseContext.recover(); } for (unsigned int i = 0; i < yyval.interm.typeList->size(); ++i) { // // Careful not to replace already know aspects of type, like array-ness // (*yyval.interm.typeList)[i].type->setType(yyvsp[-2].interm.type.type, yyvsp[-2].interm.type.size, yyvsp[-2].interm.type.matrix, yyvsp[-2].interm.type.userDef); if (yyvsp[-2].interm.type.userDef) (*yyval.interm.typeList)[i].type->setTypeName(yyvsp[-2].interm.type.userDef->getTypeName()); } ; break;} case 161: #line 1641 "glslang.y" { yyval.interm.typeList = NewPoolTTypeList(); yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine); ; break;} case 162: #line 1645 "glslang.y" { yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine); ; break;} case 163: #line 1651 "glslang.y" { yyval.interm.typeLine.type = new TType(EbtVoid); yyval.interm.typeLine.line = yyvsp[0].lex.line; yyval.interm.typeLine.type->setFieldName(*yyvsp[0].lex.string); ; break;} case 164: #line 1656 "glslang.y" { yyval.interm.typeLine.type = new TType(EbtVoid); yyval.interm.typeLine.line = yyvsp[-3].lex.line; yyval.interm.typeLine.type->setFieldName(*yyvsp[-3].lex.string); if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion() == 0 || yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getBasicType() != EbtInt || yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst <= 0) { parseContext.error(yyvsp[-2].lex.line, "structure field array size must be a positive integer", yyvsp[-3].lex.string->c_str(), ""); parseContext.recover(); } else { yyval.interm.typeLine.type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst); } ; break;} case 165: #line 1672 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 166: #line 1676 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 167: #line 1680 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermAggregate; ; break;} case 168: #line 1681 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 169: #line 1687 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 170: #line 1688 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 171: #line 1689 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 172: #line 1690 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 173: #line 1691 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 174: #line 1695 "glslang.y" { yyval.interm.intermAggregate = 0; ; break;} case 175: #line 1696 "glslang.y" { parseContext.symbolTable.push(); ; break;} case 176: #line 1696 "glslang.y" { parseContext.symbolTable.pop(); ; break;} case 177: #line 1696 "glslang.y" { if (yyvsp[-2].interm.intermAggregate != 0) yyvsp[-2].interm.intermAggregate->setOperator(EOpSequence); yyval.interm.intermAggregate = yyvsp[-2].interm.intermAggregate; ; break;} case 178: #line 1704 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 179: #line 1705 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 180: #line 1710 "glslang.y" { yyval.interm.intermNode = 0; ; break;} case 181: #line 1713 "glslang.y" { if (yyvsp[-1].interm.intermAggregate) yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence); yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate; ; break;} case 182: #line 1721 "glslang.y" { yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(yyvsp[0].interm.intermNode, 0); ; break;} case 183: #line 1724 "glslang.y" { yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermAggregate, yyvsp[0].interm.intermNode, 0); ; break;} case 184: #line 1730 "glslang.y" { yyval.interm.intermNode = 0; ; break;} case 185: #line 1731 "glslang.y" { yyval.interm.intermNode = static_cast(yyvsp[-1].interm.intermTypedNode); ; break;} case 186: #line 1735 "glslang.y" { if (parseContext.boolErrorCheck(yyvsp[-4].lex.line, yyvsp[-2].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermNode = parseContext.intermediate.addSelection(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.nodePair, yyvsp[-4].lex.line); ; break;} case 187: #line 1743 "glslang.y" { yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermNode; yyval.interm.nodePair.node2 = yyvsp[0].interm.intermNode; ; break;} case 188: #line 1747 "glslang.y" { yyval.interm.nodePair.node1 = yyvsp[0].interm.intermNode; yyval.interm.nodePair.node2 = 0; ; break;} case 189: #line 1757 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; if (parseContext.boolErrorCheck(yyvsp[0].interm.intermTypedNode->getLine(), yyvsp[0].interm.intermTypedNode)) parseContext.recover(); ; break;} case 190: #line 1762 "glslang.y" { TIntermNode* intermNode; if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type)) parseContext.recover(); if (parseContext.boolErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type)) parseContext.recover(); if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; else { parseContext.recover(); yyval.interm.intermTypedNode = 0; } ; break;} case 191: #line 1779 "glslang.y" { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ; break;} case 192: #line 1779 "glslang.y" { parseContext.symbolTable.pop(); yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, true, yyvsp[-5].lex.line); --parseContext.loopNestingLevel; ; break;} case 193: #line 1784 "glslang.y" { ++parseContext.loopNestingLevel; ; break;} case 194: #line 1784 "glslang.y" { if (parseContext.boolErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.intermTypedNode)) parseContext.recover(); yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[-5].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, false, yyvsp[-4].lex.line); --parseContext.loopNestingLevel; ; break;} case 195: #line 1791 "glslang.y" { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ; break;} case 196: #line 1791 "glslang.y" { parseContext.symbolTable.pop(); yyval.interm.intermNode = parseContext.intermediate.makeAggregate(yyvsp[-3].interm.intermNode, yyvsp[-5].lex.line); yyval.interm.intermNode = parseContext.intermediate.growAggregate( yyval.interm.intermNode, parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, reinterpret_cast(yyvsp[-2].interm.nodePair.node1), reinterpret_cast(yyvsp[-2].interm.nodePair.node2), true, yyvsp[-6].lex.line), yyvsp[-6].lex.line); yyval.interm.intermNode->getAsAggregate()->setOperator(EOpSequence); --parseContext.loopNestingLevel; ; break;} case 197: #line 1804 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 198: #line 1807 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 199: #line 1813 "glslang.y" { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ; break;} case 200: #line 1816 "glslang.y" { yyval.interm.intermTypedNode = 0; ; break;} case 201: #line 1822 "glslang.y" { yyval.interm.nodePair.node1 = yyvsp[-1].interm.intermTypedNode; yyval.interm.nodePair.node2 = 0; ; break;} case 202: #line 1826 "glslang.y" { yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermTypedNode; yyval.interm.nodePair.node2 = yyvsp[0].interm.intermTypedNode; ; break;} case 203: #line 1833 "glslang.y" { if (parseContext.loopNestingLevel <= 0) { parseContext.error(yyvsp[-1].lex.line, "continue statement only allowed in loops", "", ""); parseContext.recover(); } yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpContinue, yyvsp[-1].lex.line); ; break;} case 204: #line 1840 "glslang.y" { if (parseContext.loopNestingLevel <= 0) { parseContext.error(yyvsp[-1].lex.line, "break statement only allowed in loops", "", ""); parseContext.recover(); } yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpBreak, yyvsp[-1].lex.line); ; break;} case 205: #line 1847 "glslang.y" { yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].lex.line); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) { parseContext.error(yyvsp[-1].lex.line, "non-void function must return a value", "return", ""); parseContext.recover(); } ; break;} case 206: #line 1854 "glslang.y" { yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line); parseContext.functionReturnsValue = true; if (parseContext.currentFunctionType->getBasicType() == EbtVoid) { parseContext.error(yyvsp[-2].lex.line, "void function cannot return a value", "return", ""); parseContext.recover(); } else if (*(parseContext.currentFunctionType) != yyvsp[-1].interm.intermTypedNode->getType()) { parseContext.error(yyvsp[-2].lex.line, "function return is not matching type:", "return", ""); parseContext.recover(); } ; break;} case 207: #line 1865 "glslang.y" { FRAG_ONLY("discard", yyvsp[-1].lex.line); yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpKill, yyvsp[-1].lex.line); ; break;} case 208: #line 1874 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; parseContext.treeRoot = yyval.interm.intermNode; ; break;} case 209: #line 1878 "glslang.y" { yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermNode, yyvsp[0].interm.intermNode, 0); parseContext.treeRoot = yyval.interm.intermNode; ; break;} case 210: #line 1885 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 211: #line 1888 "glslang.y" { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ; break;} case 212: #line 1894 "glslang.y" { TFunction& function = *(yyvsp[0].interm.function); TFunction* prevDec = static_cast(parseContext.symbolTable.find(function.getMangledName())); // // Note: 'prevDec' could be 'function' if this is the first time we've seen function // as it would have just been put in the symbol table. Otherwise, we're looking up // an earlier occurance. // if (prevDec->isDefined()) { // // Then this function already has a body. // parseContext.error(yyvsp[0].interm.line, "function already has a body", function.getName().c_str(), ""); parseContext.recover(); } prevDec->setDefined(); // // Raise error message if main function takes any parameters or return anything other than void // if (function.getName() == "main") { if (function.getParamCount() > 0) { parseContext.error(yyvsp[0].interm.line, "function cannot take any parameter(s)", function.getName().c_str(), ""); parseContext.recover(); } if (function.getReturnType().getBasicType() != EbtVoid) { parseContext.error(yyvsp[0].interm.line, "", function.getReturnType().getBasicString(), "main function cannot return a value" ); parseContext.recover(); } } // // New symbol table scope for body of function plus its arguments // parseContext.symbolTable.push(); // // Remember the return type for later checking for RETURN statements. // parseContext.currentFunctionType = &(prevDec->getReturnType()); parseContext.functionReturnsValue = false; // // Insert parameters into the symbol table. // If the parameter has no name, it's not an error, just don't insert it // (could be used for unused args). // // Also, accumulate the list of parameters into the HIL, so lower level code // knows where to find parameters. // TIntermAggregate* paramNodes = new TIntermAggregate; for (int i = 0; i < function.getParamCount(); i++) { TParameter& param = function[i]; if (param.name != 0) { TVariable *variable = new TVariable(param.name, *param.type); // // Insert the parameters with name in the symbol table. // if (! parseContext.symbolTable.insert(*variable)) { parseContext.error(yyvsp[0].interm.line, "redefinition", variable->getName().c_str(), ""); parseContext.recover(); delete variable; } // // Transfer ownership of name pointer to symbol table. // param.name = 0; // // Add the parameter to the HIL // paramNodes = parseContext.intermediate.growAggregate( paramNodes, parseContext.intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), yyvsp[0].interm.line), yyvsp[0].interm.line); } else { paramNodes = parseContext.intermediate.growAggregate(paramNodes, parseContext.intermediate.addSymbol(0, "", *param.type, yyvsp[0].interm.line), yyvsp[0].interm.line); } } parseContext.intermediate.setAggregateOperator(paramNodes, EOpParameters, yyvsp[0].interm.line); yyvsp[0].interm.intermAggregate = paramNodes; parseContext.loopNestingLevel = 0; ; break;} case 213: #line 1979 "glslang.y" { //?? Check that all paths return a value if return type != void ? // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) { parseContext.error(yyvsp[-2].interm.line, "function does not return a value:", "", yyvsp[-2].interm.function->getName().c_str()); parseContext.recover(); } parseContext.symbolTable.pop(); yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermAggregate, yyvsp[0].interm.intermNode, 0); parseContext.intermediate.setAggregateOperator(yyval.interm.intermNode, EOpFunction, yyvsp[-2].interm.line); yyval.interm.intermNode->getAsAggregate()->setName(yyvsp[-2].interm.function->getMangledName().c_str()); yyval.interm.intermNode->getAsAggregate()->setType(yyvsp[-2].interm.function->getReturnType()); ; break;} } /* the action file gets copied in in place of this dollarsign */ yyvsp -= yylen; yyssp -= yylen; #ifdef YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; #ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; msg = (char *) malloc(size + 15); if (msg != 0) { strcpy(msg, "parse error"); if (count < 5) { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; } } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #ifdef YYLSP_NEEDED yylsp--; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, "); #endif *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; } #line 1994 "glslang.y"