mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
3510 lines
152 KiB
C++
3510 lines
152 KiB
C++
|
||
/* A Bison parser, made from src/compiler/glslang.y with Bison version GNU Bison version 1.24
|
||
*/
|
||
|
||
#define YYBISON 1 /* Identify Bison output. */
|
||
|
||
#define INVARIANT 258
|
||
#define HIGH_PRECISION 259
|
||
#define MEDIUM_PRECISION 260
|
||
#define LOW_PRECISION 261
|
||
#define PRECISION 262
|
||
#define ATTRIBUTE 263
|
||
#define CONST_QUAL 264
|
||
#define BOOL_TYPE 265
|
||
#define FLOAT_TYPE 266
|
||
#define INT_TYPE 267
|
||
#define BREAK 268
|
||
#define CONTINUE 269
|
||
#define DO 270
|
||
#define ELSE 271
|
||
#define FOR 272
|
||
#define IF 273
|
||
#define DISCARD 274
|
||
#define RETURN 275
|
||
#define BVEC2 276
|
||
#define BVEC3 277
|
||
#define BVEC4 278
|
||
#define IVEC2 279
|
||
#define IVEC3 280
|
||
#define IVEC4 281
|
||
#define VEC2 282
|
||
#define VEC3 283
|
||
#define VEC4 284
|
||
#define MATRIX2 285
|
||
#define MATRIX3 286
|
||
#define MATRIX4 287
|
||
#define IN_QUAL 288
|
||
#define OUT_QUAL 289
|
||
#define INOUT_QUAL 290
|
||
#define UNIFORM 291
|
||
#define VARYING 292
|
||
#define STRUCT 293
|
||
#define VOID_TYPE 294
|
||
#define WHILE 295
|
||
#define SAMPLER2D 296
|
||
#define SAMPLERCUBE 297
|
||
#define IDENTIFIER 298
|
||
#define TYPE_NAME 299
|
||
#define FLOATCONSTANT 300
|
||
#define INTCONSTANT 301
|
||
#define BOOLCONSTANT 302
|
||
#define FIELD_SELECTION 303
|
||
#define LEFT_OP 304
|
||
#define RIGHT_OP 305
|
||
#define INC_OP 306
|
||
#define DEC_OP 307
|
||
#define LE_OP 308
|
||
#define GE_OP 309
|
||
#define EQ_OP 310
|
||
#define NE_OP 311
|
||
#define AND_OP 312
|
||
#define OR_OP 313
|
||
#define XOR_OP 314
|
||
#define MUL_ASSIGN 315
|
||
#define DIV_ASSIGN 316
|
||
#define ADD_ASSIGN 317
|
||
#define MOD_ASSIGN 318
|
||
#define LEFT_ASSIGN 319
|
||
#define RIGHT_ASSIGN 320
|
||
#define AND_ASSIGN 321
|
||
#define XOR_ASSIGN 322
|
||
#define OR_ASSIGN 323
|
||
#define SUB_ASSIGN 324
|
||
#define LEFT_PAREN 325
|
||
#define RIGHT_PAREN 326
|
||
#define LEFT_BRACKET 327
|
||
#define RIGHT_BRACKET 328
|
||
#define LEFT_BRACE 329
|
||
#define RIGHT_BRACE 330
|
||
#define DOT 331
|
||
#define COMMA 332
|
||
#define COLON 333
|
||
#define EQUAL 334
|
||
#define SEMICOLON 335
|
||
#define BANG 336
|
||
#define DASH 337
|
||
#define TILDE 338
|
||
#define PLUS 339
|
||
#define STAR 340
|
||
#define SLASH 341
|
||
#define PERCENT 342
|
||
#define LEFT_ANGLE 343
|
||
#define RIGHT_ANGLE 344
|
||
#define VERTICAL_BAR 345
|
||
#define CARET 346
|
||
#define AMPERSAND 347
|
||
#define QUESTION 348
|
||
|
||
|
||
|
||
/* 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 "compiler/SymbolTable.h"
|
||
#include "compiler/ParseHelper.h"
|
||
#include "GLSLANG/ShaderLang.h"
|
||
|
||
#define YYPARSE_PARAM parseContextLocal
|
||
/*
|
||
TODO(alokp): YYPARSE_PARAM_DECL is only here to support old bison.exe in
|
||
compiler/tools. Remove it when we can exclusively use the newer version.
|
||
*/
|
||
#define YYPARSE_PARAM_DECL void*
|
||
#define parseContext ((TParseContext*)(parseContextLocal))
|
||
#define YYLEX_PARAM parseContextLocal
|
||
#define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
|
||
extern void yyerror(const char*);
|
||
|
||
#define FRAG_VERT_ONLY(S, L) { \
|
||
if (parseContext->shaderType != SH_FRAGMENT_SHADER && \
|
||
parseContext->shaderType != SH_VERTEX_SHADER) { \
|
||
parseContext->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
|
||
parseContext->recover(); \
|
||
} \
|
||
}
|
||
|
||
#define VERTEX_ONLY(S, L) { \
|
||
if (parseContext->shaderType != SH_VERTEX_SHADER) { \
|
||
parseContext->error(L, " supported in vertex shaders only ", S, "", ""); \
|
||
parseContext->recover(); \
|
||
} \
|
||
}
|
||
|
||
#define FRAG_ONLY(S, L) { \
|
||
if (parseContext->shaderType != SH_FRAGMENT_SHADER) { \
|
||
parseContext->error(L, " supported in fragment shaders only ", S, "", ""); \
|
||
parseContext->recover(); \
|
||
} \
|
||
}
|
||
|
||
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;
|
||
TPrecision precision;
|
||
TQualifier qualifier;
|
||
TFunction* function;
|
||
TParameter param;
|
||
TTypeLine typeLine;
|
||
TTypeList* typeList;
|
||
};
|
||
} interm;
|
||
} YYSTYPE;
|
||
|
||
extern int yylex(YYSTYPE*, void*);
|
||
|
||
#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
|
||
|
||
#include <stdio.h>
|
||
|
||
#ifndef __cplusplus
|
||
#ifndef __STDC__
|
||
#define const
|
||
#endif
|
||
#endif
|
||
|
||
|
||
|
||
#define YYFINAL 296
|
||
#define YYFLAG -32768
|
||
#define YYNTBASE 94
|
||
|
||
#define YYTRANSLATE(x) ((unsigned)(x) <= 348 ? yytranslate[x] : 171)
|
||
|
||
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, 93
|
||
};
|
||
|
||
#if YYDEBUG != 0
|
||
static const short yyprhs[] = { 0,
|
||
0, 2, 4, 6, 8, 10, 14, 16, 21, 23,
|
||
27, 30, 33, 35, 37, 39, 43, 46, 49, 52,
|
||
54, 57, 61, 64, 66, 68, 70, 72, 75, 78,
|
||
81, 83, 85, 87, 89, 93, 97, 99, 103, 107,
|
||
109, 111, 115, 119, 123, 127, 129, 133, 137, 139,
|
||
141, 143, 145, 149, 151, 155, 157, 161, 163, 169,
|
||
171, 175, 177, 179, 181, 183, 185, 187, 191, 193,
|
||
196, 199, 204, 207, 209, 211, 214, 218, 222, 225,
|
||
231, 235, 238, 242, 245, 246, 248, 250, 252, 254,
|
||
256, 260, 266, 273, 279, 281, 284, 289, 295, 300,
|
||
303, 305, 308, 310, 312, 314, 317, 319, 321, 324,
|
||
326, 328, 330, 332, 337, 339, 341, 343, 345, 347,
|
||
349, 351, 353, 355, 357, 359, 361, 363, 365, 367,
|
||
369, 371, 373, 375, 377, 383, 388, 390, 393, 397,
|
||
399, 403, 405, 410, 412, 414, 416, 418, 420, 422,
|
||
424, 426, 428, 431, 432, 433, 439, 441, 443, 446,
|
||
450, 452, 455, 457, 460, 466, 470, 472, 474, 479,
|
||
480, 487, 488, 497, 498, 506, 508, 510, 512, 513,
|
||
516, 520, 523, 526, 529, 533, 536, 538, 541, 543,
|
||
545, 546
|
||
};
|
||
|
||
static const short yyrhs[] = { 43,
|
||
0, 94, 0, 46, 0, 45, 0, 47, 0, 70,
|
||
121, 71, 0, 95, 0, 96, 72, 97, 73, 0,
|
||
98, 0, 96, 76, 48, 0, 96, 51, 0, 96,
|
||
52, 0, 121, 0, 99, 0, 100, 0, 96, 76,
|
||
100, 0, 102, 71, 0, 101, 71, 0, 103, 39,
|
||
0, 103, 0, 103, 119, 0, 102, 77, 119, 0,
|
||
104, 70, 0, 136, 0, 43, 0, 48, 0, 96,
|
||
0, 51, 105, 0, 52, 105, 0, 106, 105, 0,
|
||
84, 0, 82, 0, 81, 0, 105, 0, 107, 85,
|
||
105, 0, 107, 86, 105, 0, 107, 0, 108, 84,
|
||
107, 0, 108, 82, 107, 0, 108, 0, 109, 0,
|
||
110, 88, 109, 0, 110, 89, 109, 0, 110, 53,
|
||
109, 0, 110, 54, 109, 0, 110, 0, 111, 55,
|
||
110, 0, 111, 56, 110, 0, 111, 0, 112, 0,
|
||
113, 0, 114, 0, 115, 57, 114, 0, 115, 0,
|
||
116, 59, 115, 0, 116, 0, 117, 58, 116, 0,
|
||
117, 0, 117, 93, 121, 78, 119, 0, 118, 0,
|
||
105, 120, 119, 0, 79, 0, 60, 0, 61, 0,
|
||
62, 0, 69, 0, 119, 0, 121, 77, 119, 0,
|
||
118, 0, 124, 80, 0, 132, 80, 0, 7, 137,
|
||
138, 80, 0, 125, 71, 0, 127, 0, 126, 0,
|
||
127, 129, 0, 126, 77, 129, 0, 134, 43, 70,
|
||
0, 136, 43, 0, 136, 43, 72, 122, 73, 0,
|
||
135, 130, 128, 0, 130, 128, 0, 135, 130, 131,
|
||
0, 130, 131, 0, 0, 33, 0, 34, 0, 35,
|
||
0, 136, 0, 133, 0, 132, 77, 43, 0, 132,
|
||
77, 43, 72, 73, 0, 132, 77, 43, 72, 122,
|
||
73, 0, 132, 77, 43, 79, 145, 0, 134, 0,
|
||
134, 43, 0, 134, 43, 72, 73, 0, 134, 43,
|
||
72, 122, 73, 0, 134, 43, 79, 145, 0, 3,
|
||
43, 0, 136, 0, 135, 136, 0, 9, 0, 8,
|
||
0, 37, 0, 3, 37, 0, 36, 0, 138, 0,
|
||
137, 138, 0, 4, 0, 5, 0, 6, 0, 139,
|
||
0, 139, 72, 122, 73, 0, 39, 0, 11, 0,
|
||
12, 0, 10, 0, 27, 0, 28, 0, 29, 0,
|
||
21, 0, 22, 0, 23, 0, 24, 0, 25, 0,
|
||
26, 0, 30, 0, 31, 0, 32, 0, 41, 0,
|
||
42, 0, 140, 0, 44, 0, 38, 43, 74, 141,
|
||
75, 0, 38, 74, 141, 75, 0, 142, 0, 141,
|
||
142, 0, 136, 143, 80, 0, 144, 0, 143, 77,
|
||
144, 0, 43, 0, 43, 72, 122, 73, 0, 119,
|
||
0, 123, 0, 149, 0, 148, 0, 146, 0, 155,
|
||
0, 156, 0, 159, 0, 166, 0, 74, 75, 0,
|
||
0, 0, 74, 150, 154, 151, 75, 0, 153, 0,
|
||
148, 0, 74, 75, 0, 74, 154, 75, 0, 147,
|
||
0, 154, 147, 0, 80, 0, 121, 80, 0, 18,
|
||
70, 121, 71, 157, 0, 147, 16, 147, 0, 147,
|
||
0, 121, 0, 134, 43, 79, 145, 0, 0, 40,
|
||
70, 160, 158, 71, 152, 0, 0, 15, 161, 147,
|
||
40, 70, 121, 71, 80, 0, 0, 17, 70, 162,
|
||
163, 165, 71, 152, 0, 155, 0, 146, 0, 158,
|
||
0, 0, 164, 80, 0, 164, 80, 121, 0, 14,
|
||
80, 0, 13, 80, 0, 20, 80, 0, 20, 121,
|
||
80, 0, 19, 80, 0, 168, 0, 167, 168, 0,
|
||
169, 0, 123, 0, 0, 124, 170, 153, 0
|
||
};
|
||
|
||
#endif
|
||
|
||
#if YYDEBUG != 0
|
||
static const short yyrline[] = { 0,
|
||
161, 196, 199, 212, 217, 222, 228, 231, 304, 307,
|
||
416, 426, 439, 447, 546, 549, 557, 561, 568, 572,
|
||
579, 585, 594, 602, 664, 671, 681, 684, 694, 704,
|
||
725, 726, 727, 732, 733, 742, 754, 755, 763, 774,
|
||
778, 779, 789, 799, 809, 822, 823, 833, 846, 850,
|
||
854, 858, 859, 872, 873, 886, 887, 900, 901, 918,
|
||
919, 932, 933, 934, 935, 936, 940, 943, 954, 962,
|
||
987, 992, 999, 1035, 1038, 1045, 1053, 1074, 1093, 1104,
|
||
1133, 1138, 1148, 1153, 1163, 1166, 1169, 1172, 1178, 1185,
|
||
1195, 1207, 1225, 1249, 1272, 1276, 1290, 1310, 1339, 1359,
|
||
1435, 1444, 1467, 1470, 1476, 1484, 1492, 1500, 1503, 1510,
|
||
1513, 1516, 1522, 1525, 1540, 1544, 1548, 1552, 1561, 1566,
|
||
1571, 1576, 1581, 1586, 1591, 1596, 1601, 1606, 1612, 1618,
|
||
1624, 1629, 1634, 1639, 1652, 1665, 1673, 1676, 1691, 1722,
|
||
1726, 1732, 1740, 1756, 1760, 1764, 1765, 1771, 1772, 1773,
|
||
1774, 1775, 1779, 1780, 1780, 1780, 1788, 1789, 1794, 1797,
|
||
1805, 1808, 1814, 1815, 1819, 1827, 1831, 1841, 1846, 1863,
|
||
1863, 1868, 1868, 1875, 1875, 1883, 1886, 1892, 1895, 1901,
|
||
1905, 1912, 1919, 1926, 1933, 1944, 1953, 1957, 1964, 1967,
|
||
1973, 2054
|
||
};
|
||
|
||
static const char * const yytname[] = { "$","error","$undefined.","INVARIANT",
|
||
"HIGH_PRECISION","MEDIUM_PRECISION","LOW_PRECISION","PRECISION","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","SAMPLER2D","SAMPLERCUBE","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_or_method","function_call_generic","function_call_header_no_parameters",
|
||
"function_call_header_with_parameters","function_call_header","function_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",
|
||
"precision_qualifier","type_specifier_no_prec","type_specifier_nonarray","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,
|
||
94, 95, 95, 95, 95, 95, 96, 96, 96, 96,
|
||
96, 96, 97, 98, 99, 99, 100, 100, 101, 101,
|
||
102, 102, 103, 104, 104, 104, 105, 105, 105, 105,
|
||
106, 106, 106, 107, 107, 107, 108, 108, 108, 109,
|
||
110, 110, 110, 110, 110, 111, 111, 111, 112, 113,
|
||
114, 115, 115, 116, 116, 117, 117, 118, 118, 119,
|
||
119, 120, 120, 120, 120, 120, 121, 121, 122, 123,
|
||
123, 123, 124, 125, 125, 126, 126, 127, 128, 128,
|
||
129, 129, 129, 129, 130, 130, 130, 130, 131, 132,
|
||
132, 132, 132, 132, 133, 133, 133, 133, 133, 133,
|
||
134, 134, 135, 135, 135, 135, 135, 136, 136, 137,
|
||
137, 137, 138, 138, 139, 139, 139, 139, 139, 139,
|
||
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
|
||
139, 139, 139, 139, 140, 140, 141, 141, 142, 143,
|
||
143, 144, 144, 145, 146, 147, 147, 148, 148, 148,
|
||
148, 148, 149, 150, 151, 149, 152, 152, 153, 153,
|
||
154, 154, 155, 155, 156, 157, 157, 158, 158, 160,
|
||
159, 161, 159, 162, 159, 163, 163, 164, 164, 165,
|
||
165, 166, 166, 166, 166, 166, 167, 167, 168, 168,
|
||
170, 169
|
||
};
|
||
|
||
static const short yyr2[] = { 0,
|
||
1, 1, 1, 1, 1, 3, 1, 4, 1, 3,
|
||
2, 2, 1, 1, 1, 3, 2, 2, 2, 1,
|
||
2, 3, 2, 1, 1, 1, 1, 2, 2, 2,
|
||
1, 1, 1, 1, 3, 3, 1, 3, 3, 1,
|
||
1, 3, 3, 3, 3, 1, 3, 3, 1, 1,
|
||
1, 1, 3, 1, 3, 1, 3, 1, 5, 1,
|
||
3, 1, 1, 1, 1, 1, 1, 3, 1, 2,
|
||
2, 4, 2, 1, 1, 2, 3, 3, 2, 5,
|
||
3, 2, 3, 2, 0, 1, 1, 1, 1, 1,
|
||
3, 5, 6, 5, 1, 2, 4, 5, 4, 2,
|
||
1, 2, 1, 1, 1, 2, 1, 1, 2, 1,
|
||
1, 1, 1, 4, 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,
|
||
0, 110, 111, 112, 0, 104, 103, 118, 116, 117,
|
||
122, 123, 124, 125, 126, 127, 119, 120, 121, 128,
|
||
129, 130, 107, 105, 0, 115, 131, 132, 134, 190,
|
||
191, 0, 75, 85, 0, 90, 95, 0, 101, 0,
|
||
108, 113, 133, 0, 187, 189, 106, 100, 0, 0,
|
||
0, 70, 0, 73, 85, 0, 86, 87, 88, 76,
|
||
0, 85, 0, 71, 96, 102, 109, 0, 188, 0,
|
||
0, 0, 0, 137, 0, 192, 77, 82, 84, 89,
|
||
0, 91, 78, 0, 0, 1, 4, 3, 5, 26,
|
||
0, 0, 0, 33, 32, 31, 2, 7, 27, 9,
|
||
14, 15, 0, 0, 20, 0, 34, 0, 37, 40,
|
||
41, 46, 49, 50, 51, 52, 54, 56, 58, 69,
|
||
0, 24, 72, 0, 142, 0, 140, 136, 138, 0,
|
||
0, 172, 0, 0, 0, 0, 0, 154, 159, 163,
|
||
34, 60, 67, 0, 145, 0, 101, 148, 161, 147,
|
||
146, 0, 149, 150, 151, 152, 79, 81, 83, 0,
|
||
0, 97, 0, 144, 99, 28, 29, 0, 11, 12,
|
||
0, 0, 18, 17, 0, 115, 21, 23, 30, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 114, 135, 0, 0, 139, 183, 182,
|
||
0, 174, 0, 186, 184, 0, 170, 153, 0, 63,
|
||
64, 65, 66, 62, 0, 0, 164, 160, 162, 0,
|
||
92, 0, 94, 98, 6, 0, 13, 25, 10, 16,
|
||
22, 35, 36, 39, 38, 44, 45, 42, 43, 47,
|
||
48, 53, 55, 57, 0, 0, 141, 0, 0, 0,
|
||
185, 0, 155, 61, 68, 0, 93, 8, 0, 143,
|
||
0, 177, 176, 179, 0, 168, 0, 0, 0, 80,
|
||
59, 0, 178, 0, 0, 167, 165, 0, 0, 156,
|
||
0, 180, 0, 0, 0, 158, 171, 157, 0, 181,
|
||
175, 166, 169, 173, 0, 0
|
||
};
|
||
|
||
static const short yydefgoto[] = { 97,
|
||
98, 99, 226, 100, 101, 102, 103, 104, 105, 106,
|
||
141, 108, 109, 110, 111, 112, 113, 114, 115, 116,
|
||
117, 118, 119, 142, 143, 215, 144, 121, 145, 146,
|
||
32, 33, 34, 78, 60, 61, 79, 35, 36, 37,
|
||
38, 122, 40, 41, 42, 43, 73, 74, 126, 127,
|
||
165, 148, 149, 150, 151, 209, 269, 287, 288, 152,
|
||
153, 154, 277, 268, 155, 252, 201, 249, 264, 274,
|
||
275, 156, 44, 45, 46, 53
|
||
};
|
||
|
||
static const short yypact[] = { 1224,
|
||
2,-32768,-32768,-32768, 115,-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,
|
||
-67, 36, -54, 23, 11,-32768, 27, 1265,-32768, 1289,
|
||
-32768, 5,-32768, 1137,-32768,-32768,-32768,-32768, 1289, 42,
|
||
1265,-32768, 56,-32768, 76, 99,-32768,-32768,-32768,-32768,
|
||
1265, 94, 108,-32768, -52,-32768,-32768, 907,-32768, 78,
|
||
1265, 116, 1041,-32768, 282,-32768,-32768,-32768,-32768, 117,
|
||
1265, -55,-32768, 193, 907, 91,-32768,-32768,-32768,-32768,
|
||
907, 907, 907,-32768,-32768,-32768,-32768,-32768, -42,-32768,
|
||
-32768,-32768, 93, -5, 974, 92,-32768, 907, 15, -47,
|
||
-32768, -25, -1,-32768,-32768,-32768, 110, 106, -53,-32768,
|
||
95,-32768,-32768, 1082, 97, 26,-32768,-32768,-32768, 90,
|
||
98,-32768, 101, 102, 100, 759, 103, 104,-32768,-32768,
|
||
7,-32768,-32768, 28,-32768, -67, 111,-32768,-32768,-32768,
|
||
-32768, 364,-32768,-32768,-32768,-32768, 112,-32768,-32768, 826,
|
||
907,-32768, 109,-32768,-32768,-32768,-32768, 3,-32768,-32768,
|
||
907, 1178,-32768,-32768, 907, 118,-32768,-32768,-32768, 907,
|
||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||
907, 907, 907,-32768,-32768, 907, 116,-32768,-32768,-32768,
|
||
446,-32768, 907,-32768,-32768, 38,-32768,-32768, 446,-32768,
|
||
-32768,-32768,-32768,-32768, 907, 907,-32768,-32768,-32768, 907,
|
||
-32768, 113,-32768,-32768,-32768, 114, 119,-32768, 120,-32768,
|
||
-32768,-32768,-32768, 15, 15,-32768,-32768,-32768,-32768, -25,
|
||
-25,-32768, 110, 106, 45, 121,-32768, 134, 610, 12,
|
||
-32768, 692, 446,-32768,-32768, 122,-32768,-32768, 907,-32768,
|
||
130,-32768,-32768, 692, 446, 119, 145, 135, 132,-32768,
|
||
-32768, 907,-32768, 128, 139, 175,-32768, 133, 528,-32768,
|
||
16, 907, 528, 446, 907,-32768,-32768,-32768, 131, 119,
|
||
-32768,-32768,-32768,-32768, 192,-32768
|
||
};
|
||
|
||
static const short yypgoto[] = {-32768,
|
||
-32768,-32768,-32768,-32768,-32768, 41,-32768,-32768,-32768,-32768,
|
||
-43,-32768, -48,-32768, -88, -32,-32768,-32768,-32768, 37,
|
||
35, 50,-32768, -65, -83,-32768, -89, -70, 6, 8,
|
||
-32768,-32768,-32768, 147, 174, 168, 152,-32768,-32768, -231,
|
||
-19, 0, 238, -33,-32768,-32768, 176, -62,-32768, 49,
|
||
-160, 1, -99, -237,-32768,-32768,-32768, -35, 198, 46,
|
||
9,-32768,-32768, -10,-32768,-32768,-32768,-32768,-32768,-32768,
|
||
-32768,-32768,-32768, 212,-32768,-32768
|
||
};
|
||
|
||
|
||
#define YYLAST 1333
|
||
|
||
|
||
static const short yytable[] = { 39,
|
||
223, 164, 120, 168, 192, 30, 67, 31, 169, 170,
|
||
129, 50, 52, 163, 62, 70, 160, 83, 120, 84,
|
||
267, 177, 55, 161, 107, 56, 85, 184, 185, 171,
|
||
6, 7, 267, 172, 182, 62, 183, 66, 47, 193,
|
||
107, 286, 51, 39, 48, 286, 206, 166, 167, 30,
|
||
72, 31, 219, 188, 189, 57, 58, 59, 23, 24,
|
||
80, 129, 186, 187, 179, 174, 210, 211, 212, 65,
|
||
72, 175, 72, 225, 147, 213, 68, 164, 56, 216,
|
||
80, 227, 265, 6, 7, 214, 289, 63, 216, 222,
|
||
64, 231, 216, -74, 120, 236, 237, 238, 239, 180,
|
||
181, 248, 197, 245, 216, 198, 54, 217, 57, 58,
|
||
59, 23, 24, 250, 216, 71, 107, 251, 2, 3,
|
||
4, 216, 259, 72, 293, 246, 57, 58, 59, 75,
|
||
120, 254, 255, 234, 235, 47, 232, 233, 107, 107,
|
||
107, 107, 107, 107, 107, 107, 107, 107, 107, 256,
|
||
82, 147, 107, 219, 120, 240, 241, 123, 125, 157,
|
||
-25, 178, 266, 173, 191, 276, 190, 194, 196, 199,
|
||
202, 203, 207, 261, 266, 271, 107, 200, 208, 204,
|
||
-24, 224, 281, 220, 292, 257, 258, 278, -19, -26,
|
||
284, 296, 290, 260, 270, 216, 2, 3, 4, 272,
|
||
147, 164, 8, 9, 10, 279, 280, 282, 147, 283,
|
||
294, 285, 230, 11, 12, 13, 14, 15, 16, 17,
|
||
18, 19, 20, 21, 22, 243, 242, 158, 77, 81,
|
||
25, 26, 159, 27, 28, 86, 29, 87, 88, 89,
|
||
90, 244, 49, 91, 92, 247, 124, 291, 147, 262,
|
||
76, 147, 147, 273, 253, 69, 0, 263, 0, 0,
|
||
0, 0, 93, 147, 147, 162, 0, 0, 0, 0,
|
||
0, 0, 0, 94, 95, 0, 96, 0, 147, 0,
|
||
0, 0, 147, 147, 1, 2, 3, 4, 5, 6,
|
||
7, 8, 9, 10, 130, 131, 132, 0, 133, 134,
|
||
135, 136, 11, 12, 13, 14, 15, 16, 17, 18,
|
||
19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
|
||
26, 137, 27, 28, 86, 29, 87, 88, 89, 90,
|
||
0, 0, 91, 92, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 93, 0, 0, 0, 138, 139, 0, 0, 0,
|
||
0, 140, 94, 95, 0, 96, 1, 2, 3, 4,
|
||
5, 6, 7, 8, 9, 10, 130, 131, 132, 0,
|
||
133, 134, 135, 136, 11, 12, 13, 14, 15, 16,
|
||
17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
|
||
24, 25, 26, 137, 27, 28, 86, 29, 87, 88,
|
||
89, 90, 0, 0, 91, 92, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 93, 0, 0, 0, 138, 218, 0,
|
||
0, 0, 0, 140, 94, 95, 0, 96, 1, 2,
|
||
3, 4, 5, 6, 7, 8, 9, 10, 130, 131,
|
||
132, 0, 133, 134, 135, 136, 11, 12, 13, 14,
|
||
15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
|
||
0, 23, 24, 25, 26, 137, 27, 28, 86, 29,
|
||
87, 88, 89, 90, 0, 0, 91, 92, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 93, 0, 0, 0, 138,
|
||
0, 0, 0, 0, 0, 140, 94, 95, 0, 96,
|
||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||
130, 131, 132, 0, 133, 134, 135, 136, 11, 12,
|
||
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
||
0, 0, 0, 23, 24, 25, 26, 137, 27, 28,
|
||
86, 29, 87, 88, 89, 90, 0, 0, 91, 92,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 93, 0, 0,
|
||
0, 75, 0, 0, 0, 0, 0, 140, 94, 95,
|
||
0, 96, 1, 2, 3, 4, 5, 6, 7, 8,
|
||
9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||
21, 22, 0, 0, 0, 23, 24, 25, 26, 0,
|
||
27, 28, 86, 29, 87, 88, 89, 90, 0, 0,
|
||
91, 92, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 93,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 140,
|
||
94, 95, 0, 96, 56, 2, 3, 4, 0, 6,
|
||
7, 8, 9, 10, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
|
||
19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
|
||
26, 0, 27, 28, 86, 29, 87, 88, 89, 90,
|
||
0, 0, 91, 92, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 93, 2, 3, 4, 0, 0, 0, 8, 9,
|
||
10, 0, 94, 95, 0, 96, 0, 0, 0, 11,
|
||
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||
22, 0, 0, 0, 0, 0, 25, 26, 0, 27,
|
||
28, 86, 29, 87, 88, 89, 90, 0, 0, 91,
|
||
92, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 93, 2,
|
||
3, 4, 0, 0, 0, 8, 9, 10, 205, 94,
|
||
95, 0, 96, 0, 0, 0, 11, 12, 13, 14,
|
||
15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
|
||
0, 0, 0, 25, 26, 0, 27, 28, 86, 29,
|
||
87, 88, 89, 90, 0, 0, 91, 92, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 93, 0, 0, 221, 0,
|
||
0, 0, 0, 0, 0, 0, 94, 95, 0, 96,
|
||
2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
|
||
14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
|
||
0, 0, 0, 0, 25, 26, 0, 27, 28, 86,
|
||
29, 87, 88, 89, 90, 0, 0, 91, 92, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 93, 2, 3, 4,
|
||
0, 0, 0, 8, 9, 10, 0, 94, 95, 0,
|
||
96, 0, 0, 0, 11, 12, 13, 14, 15, 16,
|
||
17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
|
||
0, 25, 176, 0, 27, 28, 86, 29, 87, 88,
|
||
89, 90, 0, 0, 91, 92, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 93, 2, 3, 4, 0, 0, 0,
|
||
8, 9, 10, 0, 94, 95, 0, 96, 0, 0,
|
||
0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||
20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
|
||
0, 27, 28, 0, 29, 2, 3, 4, 0, 0,
|
||
0, 8, 9, 10, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
|
||
19, 20, 21, 22, 0, 128, 0, 0, 0, 25,
|
||
26, 0, 27, 28, 0, 29, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 0, 295, 0, 0, 1,
|
||
2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
|
||
0, 0, 0, 0, 0, 0, 195, 11, 12, 13,
|
||
14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
|
||
0, 0, 23, 24, 25, 26, 0, 27, 28, 0,
|
||
29, 2, 3, 4, 0, 0, 0, 8, 9, 10,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
|
||
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
||
0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
|
||
228, 29, 0, 0, 0, 229, 1, 2, 3, 4,
|
||
5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
|
||
0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
|
||
17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
|
||
24, 25, 26, 0, 27, 28, 0, 29, 2, 3,
|
||
4, 0, 0, 0, 8, 9, 10, 0, 0, 0,
|
||
0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
|
||
16, 17, 18, 19, 20, 21, 22, 0, 8, 9,
|
||
10, 0, 25, 26, 0, 27, 28, 0, 29, 11,
|
||
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||
22, 0, 0, 0, 0, 0, 25, 26, 0, 27,
|
||
28, 0, 29
|
||
};
|
||
|
||
static const short yycheck[] = { 0,
|
||
161, 85, 68, 93, 58, 0, 40, 0, 51, 52,
|
||
73, 43, 80, 84, 34, 49, 72, 70, 84, 72,
|
||
252, 105, 77, 79, 68, 3, 79, 53, 54, 72,
|
||
8, 9, 264, 76, 82, 55, 84, 38, 37, 93,
|
||
84, 279, 74, 44, 43, 283, 136, 91, 92, 44,
|
||
51, 44, 152, 55, 56, 33, 34, 35, 36, 37,
|
||
61, 124, 88, 89, 108, 71, 60, 61, 62, 43,
|
||
71, 77, 73, 71, 75, 69, 72, 161, 3, 77,
|
||
81, 171, 71, 8, 9, 79, 71, 77, 77, 160,
|
||
80, 175, 77, 71, 160, 184, 185, 186, 187, 85,
|
||
86, 201, 77, 193, 77, 80, 71, 80, 33, 34,
|
||
35, 36, 37, 203, 77, 74, 160, 80, 4, 5,
|
||
6, 77, 78, 124, 285, 196, 33, 34, 35, 74,
|
||
196, 215, 216, 182, 183, 37, 180, 181, 182, 183,
|
||
184, 185, 186, 187, 188, 189, 190, 191, 192, 220,
|
||
43, 152, 196, 253, 220, 188, 189, 80, 43, 43,
|
||
70, 70, 252, 71, 59, 265, 57, 73, 72, 80,
|
||
70, 70, 70, 40, 264, 259, 220, 80, 75, 80,
|
||
70, 73, 272, 72, 284, 73, 73, 43, 71, 70,
|
||
16, 0, 282, 73, 73, 77, 4, 5, 6, 70,
|
||
201, 285, 10, 11, 12, 71, 75, 80, 209, 71,
|
||
80, 79, 172, 21, 22, 23, 24, 25, 26, 27,
|
||
28, 29, 30, 31, 32, 191, 190, 81, 55, 62,
|
||
38, 39, 81, 41, 42, 43, 44, 45, 46, 47,
|
||
48, 192, 5, 51, 52, 197, 71, 283, 249, 249,
|
||
53, 252, 253, 264, 209, 44, -1, 249, -1, -1,
|
||
-1, -1, 70, 264, 265, 73, -1, -1, -1, -1,
|
||
-1, -1, -1, 81, 82, -1, 84, -1, 279, -1,
|
||
-1, -1, 283, 284, 3, 4, 5, 6, 7, 8,
|
||
9, 10, 11, 12, 13, 14, 15, -1, 17, 18,
|
||
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
||
29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
|
||
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
||
-1, -1, 51, 52, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, 70, -1, -1, -1, 74, 75, -1, -1, -1,
|
||
-1, 80, 81, 82, -1, 84, 3, 4, 5, 6,
|
||
7, 8, 9, 10, 11, 12, 13, 14, 15, -1,
|
||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
||
27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
|
||
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
|
||
47, 48, -1, -1, 51, 52, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, 70, -1, -1, -1, 74, 75, -1,
|
||
-1, -1, -1, 80, 81, 82, -1, 84, 3, 4,
|
||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||
15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
|
||
25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
|
||
-1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
|
||
45, 46, 47, 48, -1, -1, 51, 52, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, 70, -1, -1, -1, 74,
|
||
-1, -1, -1, -1, -1, 80, 81, 82, -1, 84,
|
||
3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||
13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
|
||
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||
-1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
|
||
43, 44, 45, 46, 47, 48, -1, -1, 51, 52,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, 70, -1, -1,
|
||
-1, 74, -1, -1, -1, -1, -1, 80, 81, 82,
|
||
-1, 84, 3, 4, 5, 6, 7, 8, 9, 10,
|
||
11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||
31, 32, -1, -1, -1, 36, 37, 38, 39, -1,
|
||
41, 42, 43, 44, 45, 46, 47, 48, -1, -1,
|
||
51, 52, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, 70,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, 80,
|
||
81, 82, -1, 84, 3, 4, 5, 6, -1, 8,
|
||
9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
|
||
29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
|
||
39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
|
||
-1, -1, 51, 52, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, 70, 4, 5, 6, -1, -1, -1, 10, 11,
|
||
12, -1, 81, 82, -1, 84, -1, -1, -1, 21,
|
||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||
32, -1, -1, -1, -1, -1, 38, 39, -1, 41,
|
||
42, 43, 44, 45, 46, 47, 48, -1, -1, 51,
|
||
52, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, 70, 4,
|
||
5, 6, -1, -1, -1, 10, 11, 12, 80, 81,
|
||
82, -1, 84, -1, -1, -1, 21, 22, 23, 24,
|
||
25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
|
||
-1, -1, -1, 38, 39, -1, 41, 42, 43, 44,
|
||
45, 46, 47, 48, -1, -1, 51, 52, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, 70, -1, -1, 73, -1,
|
||
-1, -1, -1, -1, -1, -1, 81, 82, -1, 84,
|
||
4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
|
||
24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
|
||
-1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
|
||
44, 45, 46, 47, 48, -1, -1, 51, 52, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, 70, 4, 5, 6,
|
||
-1, -1, -1, 10, 11, 12, -1, 81, 82, -1,
|
||
84, -1, -1, -1, 21, 22, 23, 24, 25, 26,
|
||
27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
|
||
-1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
|
||
47, 48, -1, -1, 51, 52, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, 70, 4, 5, 6, -1, -1, -1,
|
||
10, 11, 12, -1, 81, 82, -1, 84, -1, -1,
|
||
-1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||
30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
|
||
-1, 41, 42, -1, 44, 4, 5, 6, -1, -1,
|
||
-1, 10, 11, 12, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
|
||
29, 30, 31, 32, -1, 75, -1, -1, -1, 38,
|
||
39, -1, 41, 42, -1, 44, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, -1, 0, -1, -1, 3,
|
||
4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
|
||
-1, -1, -1, -1, -1, -1, 75, 21, 22, 23,
|
||
24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
|
||
-1, -1, 36, 37, 38, 39, -1, 41, 42, -1,
|
||
44, 4, 5, 6, -1, -1, -1, 10, 11, 12,
|
||
-1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
|
||
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||
-1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
|
||
43, 44, -1, -1, -1, 48, 3, 4, 5, 6,
|
||
7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
|
||
-1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
|
||
27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
|
||
37, 38, 39, -1, 41, 42, -1, 44, 4, 5,
|
||
6, -1, -1, -1, 10, 11, 12, -1, -1, -1,
|
||
-1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
|
||
26, 27, 28, 29, 30, 31, 32, -1, 10, 11,
|
||
12, -1, 38, 39, -1, 41, 42, -1, 44, 21,
|
||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||
32, -1, -1, -1, -1, -1, 38, 39, -1, 41,
|
||
42, -1, 44
|
||
};
|
||
#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 <alloca.h>
|
||
#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 <alloca.h>
|
||
#else /* not sparc */
|
||
#if (defined (MSDOS) && !defined (__TURBOC__)) || defined (WIN32)
|
||
#include <malloc.h>
|
||
#else /* not MSDOS, or __TURBOC__ */
|
||
#if defined(_AIX)
|
||
#include <malloc.h>
|
||
#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:
|
||
{
|
||
// 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();
|
||
TType type(EbtFloat, EbpUndefined);
|
||
TVariable* fakeVariable = new TVariable(yyvsp[0].lex.string, type);
|
||
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<const TVariable*>(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 ) {
|
||
ConstantUnion* constArray = variable->getConstPointer();
|
||
TType t(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:
|
||
{
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 3:
|
||
{
|
||
//
|
||
// 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();
|
||
}
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setIConst(yyvsp[0].lex.i);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 4:
|
||
{
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setFConst(yyvsp[0].lex.f);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 5:
|
||
{
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(yyvsp[0].lex.b);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 6:
|
||
{
|
||
yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 7:
|
||
{
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 8:
|
||
{
|
||
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[-1].interm.intermTypedNode->getQualifier() == EvqConst) {
|
||
if (yyvsp[-3].interm.intermTypedNode->isArray()) { // constant folding for arrays
|
||
yyval.interm.intermTypedNode = parseContext->addConstArrayNode(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);
|
||
} else if (yyvsp[-3].interm.intermTypedNode->isVector()) { // constant folding for vectors
|
||
TVectorFields fields;
|
||
fields.num = 1;
|
||
fields.offsets[0] = yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // 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()->getIConst(), 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()->getIConst() && !yyvsp[-3].interm.intermTypedNode->isArray() ) {
|
||
parseContext->error(yyvsp[-2].lex.line, "", "[", "field selection out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
|
||
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()->getIConst()) {
|
||
if (parseContext->arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), 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()->getIConst() >= yyvsp[-3].interm.intermTypedNode->getType().getArraySize()) {
|
||
parseContext->error(yyvsp[-2].lex.line, "", "[", "array index out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
|
||
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) {
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setFConst(0.0f);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, 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(), yyvsp[-3].interm.intermTypedNode->getPrecision(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize(), yyvsp[-3].interm.intermTypedNode->isMatrix()));
|
||
|
||
if (yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst)
|
||
yyval.interm.intermTypedNode->getTypePointer()->setQualifier(EvqConst);
|
||
} else if (yyvsp[-3].interm.intermTypedNode->isMatrix() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst)
|
||
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), yyvsp[-3].interm.intermTypedNode->getPrecision(), EvqConst, yyvsp[-3].interm.intermTypedNode->getNominalSize()));
|
||
else if (yyvsp[-3].interm.intermTypedNode->isMatrix())
|
||
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), yyvsp[-3].interm.intermTypedNode->getPrecision(), 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(), yyvsp[-3].interm.intermTypedNode->getPrecision(), EvqConst));
|
||
else if (yyvsp[-3].interm.intermTypedNode->isVector())
|
||
yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), yyvsp[-3].interm.intermTypedNode->getPrecision(), EvqTemporary));
|
||
else
|
||
yyval.interm.intermTypedNode->setType(yyvsp[-3].interm.intermTypedNode->getType());
|
||
;
|
||
break;}
|
||
case 9:
|
||
{
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 10:
|
||
{
|
||
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(), yyvsp[-2].interm.intermTypedNode->getPrecision(), EvqConst, (int) (*yyvsp[0].lex.string).size()));
|
||
} else {
|
||
if (fields.num == 1) {
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setIConst(fields.offsets[0]);
|
||
TIntermTyped* index = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, 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(), yyvsp[-2].interm.intermTypedNode->getPrecision()));
|
||
} 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(), yyvsp[-2].interm.intermTypedNode->getPrecision(), 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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setIConst(0);
|
||
TIntermTyped* index = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, 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(), yyvsp[-2].interm.intermTypedNode->getPrecision(),EvqTemporary, yyvsp[-2].interm.intermTypedNode->getNominalSize()));
|
||
} else {
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setIConst(fields.col * yyvsp[-2].interm.intermTypedNode->getNominalSize() + fields.row);
|
||
TIntermTyped* index = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, 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(), yyvsp[-2].interm.intermTypedNode->getPrecision()));
|
||
}
|
||
} else if (yyvsp[-2].interm.intermTypedNode->getBasicType() == EbtStruct) {
|
||
bool fieldFound = false;
|
||
const 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()->setQualifier(EvqConst);
|
||
}
|
||
} else {
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setIConst(i);
|
||
TIntermTyped* index = parseContext->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, 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:
|
||
{
|
||
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:
|
||
{
|
||
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:
|
||
{
|
||
if (parseContext->integerErrorCheck(yyvsp[0].interm.intermTypedNode, "[]"))
|
||
parseContext->recover();
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 14:
|
||
{
|
||
TFunction* fnCall = yyvsp[0].interm.function;
|
||
TOperator op = fnCall->getBuiltInOp();
|
||
|
||
if (op != EOpNull)
|
||
{
|
||
//
|
||
// Then this should be a constructor.
|
||
// Don't go through the symbol table for constructors.
|
||
// Their parameters will be verified algorithmically.
|
||
//
|
||
TType type(EbtVoid, EbpUndefined); // 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.
|
||
//
|
||
if (builtIn && !fnCandidate->getExtension().empty() &&
|
||
parseContext->extensionErrorCheck(yyvsp[0].interm.line, fnCandidate->getExtension())) {
|
||
parseContext->recover();
|
||
}
|
||
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<TIntermTyped*>(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;
|
||
for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
|
||
qual = fnCandidate->getParam(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();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType());
|
||
} else {
|
||
// error message was put out by PaFindFunction()
|
||
// Put on a dummy node for error recovery
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setFConst(0.0f);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), yyvsp[0].interm.line);
|
||
parseContext->recover();
|
||
}
|
||
}
|
||
delete fnCall;
|
||
;
|
||
break;}
|
||
case 15:
|
||
{
|
||
yyval.interm = yyvsp[0].interm;
|
||
;
|
||
break;}
|
||
case 16:
|
||
{
|
||
parseContext->error(yyvsp[0].interm.line, "methods are not supported", "", "");
|
||
parseContext->recover();
|
||
yyval.interm = yyvsp[0].interm;
|
||
;
|
||
break;}
|
||
case 17:
|
||
{
|
||
yyval.interm = yyvsp[-1].interm;
|
||
yyval.interm.line = yyvsp[0].lex.line;
|
||
;
|
||
break;}
|
||
case 18:
|
||
{
|
||
yyval.interm = yyvsp[-1].interm;
|
||
yyval.interm.line = yyvsp[0].lex.line;
|
||
;
|
||
break;}
|
||
case 19:
|
||
{
|
||
yyval.interm.function = yyvsp[-1].interm.function;
|
||
yyval.interm.intermNode = 0;
|
||
;
|
||
break;}
|
||
case 20:
|
||
{
|
||
yyval.interm.function = yyvsp[0].interm.function;
|
||
yyval.interm.intermNode = 0;
|
||
;
|
||
break;}
|
||
case 21:
|
||
{
|
||
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 22:
|
||
{
|
||
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 23:
|
||
{
|
||
yyval.interm.function = yyvsp[-1].interm.function;
|
||
;
|
||
break;}
|
||
case 24:
|
||
{
|
||
//
|
||
// Constructor
|
||
//
|
||
if (yyvsp[0].interm.type.array) {
|
||
// Constructors for arrays are not allowed.
|
||
parseContext->error(yyvsp[0].interm.type.line, "cannot construct this type", "array", "");
|
||
parseContext->recover();
|
||
yyvsp[0].interm.type.setArray(false);
|
||
}
|
||
|
||
TOperator op = EOpNull;
|
||
if (yyvsp[0].interm.type.userDef) {
|
||
op = EOpConstructStruct;
|
||
} else {
|
||
switch (yyvsp[0].interm.type.type) {
|
||
case EbtFloat:
|
||
if (yyvsp[0].interm.type.matrix) {
|
||
switch(yyvsp[0].interm.type.size) {
|
||
case 2: op = EOpConstructMat2; break;
|
||
case 3: op = EOpConstructMat3; break;
|
||
case 4: op = EOpConstructMat4; break;
|
||
}
|
||
} else {
|
||
switch(yyvsp[0].interm.type.size) {
|
||
case 1: op = EOpConstructFloat; break;
|
||
case 2: op = EOpConstructVec2; break;
|
||
case 3: op = EOpConstructVec3; break;
|
||
case 4: op = EOpConstructVec4; break;
|
||
}
|
||
}
|
||
break;
|
||
case EbtInt:
|
||
switch(yyvsp[0].interm.type.size) {
|
||
case 1: op = EOpConstructInt; break;
|
||
case 2: FRAG_VERT_ONLY("ivec2", yyvsp[0].interm.type.line); op = EOpConstructIVec2; break;
|
||
case 3: FRAG_VERT_ONLY("ivec3", yyvsp[0].interm.type.line); op = EOpConstructIVec3; break;
|
||
case 4: FRAG_VERT_ONLY("ivec4", yyvsp[0].interm.type.line); op = EOpConstructIVec4; break;
|
||
}
|
||
break;
|
||
case EbtBool:
|
||
switch(yyvsp[0].interm.type.size) {
|
||
case 1: op = EOpConstructBool; break;
|
||
case 2: FRAG_VERT_ONLY("bvec2", yyvsp[0].interm.type.line); op = EOpConstructBVec2; break;
|
||
case 3: FRAG_VERT_ONLY("bvec3", yyvsp[0].interm.type.line); op = EOpConstructBVec3; break;
|
||
case 4: FRAG_VERT_ONLY("bvec4", yyvsp[0].interm.type.line); op = EOpConstructBVec4; break;
|
||
}
|
||
break;
|
||
default: break;
|
||
}
|
||
if (op == EOpNull) {
|
||
parseContext->error(yyvsp[0].interm.type.line, "cannot construct this type", getBasicString(yyvsp[0].interm.type.type), "");
|
||
parseContext->recover();
|
||
yyvsp[0].interm.type.type = EbtFloat;
|
||
op = EOpConstructFloat;
|
||
}
|
||
}
|
||
TString tempString;
|
||
TType type(yyvsp[0].interm.type);
|
||
TFunction *function = new TFunction(&tempString, type, op);
|
||
yyval.interm.function = function;
|
||
;
|
||
break;}
|
||
case 25:
|
||
{
|
||
if (parseContext->reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
|
||
parseContext->recover();
|
||
TType type(EbtVoid, EbpUndefined);
|
||
TFunction *function = new TFunction(yyvsp[0].lex.string, type);
|
||
yyval.interm.function = function;
|
||
;
|
||
break;}
|
||
case 26:
|
||
{
|
||
if (parseContext->reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
|
||
parseContext->recover();
|
||
TType type(EbtVoid, EbpUndefined);
|
||
TFunction *function = new TFunction(yyvsp[0].lex.string, type);
|
||
yyval.interm.function = function;
|
||
;
|
||
break;}
|
||
case 27:
|
||
{
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 28:
|
||
{
|
||
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 29:
|
||
{
|
||
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 30:
|
||
{
|
||
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) {
|
||
const char* errorOp = "";
|
||
switch(yyvsp[-1].interm.op) {
|
||
case EOpNegative: errorOp = "-"; break;
|
||
case EOpLogicalNot: 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 31:
|
||
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNull; ;
|
||
break;}
|
||
case 32:
|
||
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNegative; ;
|
||
break;}
|
||
case 33:
|
||
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLogicalNot; ;
|
||
break;}
|
||
case 34:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 35:
|
||
{
|
||
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 36:
|
||
{
|
||
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 37:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 38:
|
||
{
|
||
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 39:
|
||
{
|
||
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 40:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 41:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 42:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 43:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 44:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 45:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 46:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 47:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 48:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 49:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 50:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 51:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 52:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 53:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 54:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 55:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 56:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 57:
|
||
{
|
||
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();
|
||
ConstantUnion *unionArray = new ConstantUnion[1];
|
||
unionArray->setBConst(false);
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), yyvsp[-1].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 58:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 59:
|
||
{
|
||
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 (yyvsp[-2].interm.intermTypedNode->getType() != yyvsp[0].interm.intermTypedNode->getType())
|
||
yyval.interm.intermTypedNode = 0;
|
||
|
||
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 60:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 61:
|
||
{
|
||
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 62:
|
||
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAssign; ;
|
||
break;}
|
||
case 63:
|
||
{ FRAG_VERT_ONLY("*=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpMulAssign; ;
|
||
break;}
|
||
case 64:
|
||
{ FRAG_VERT_ONLY("/=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpDivAssign; ;
|
||
break;}
|
||
case 65:
|
||
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAddAssign; ;
|
||
break;}
|
||
case 66:
|
||
{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpSubAssign; ;
|
||
break;}
|
||
case 67:
|
||
{
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 68:
|
||
{
|
||
yyval.interm.intermTypedNode = parseContext->intermediate.addComma(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);
|
||
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[0].interm.intermTypedNode;
|
||
}
|
||
;
|
||
break;}
|
||
case 69:
|
||
{
|
||
if (parseContext->constErrorCheck(yyvsp[0].interm.intermTypedNode))
|
||
parseContext->recover();
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 70:
|
||
{
|
||
TFunction &function = *(yyvsp[-1].interm.function);
|
||
|
||
TIntermAggregate *prototype = new TIntermAggregate;
|
||
prototype->setType(function.getReturnType());
|
||
prototype->setName(function.getName());
|
||
|
||
for (int i = 0; i < function.getParamCount(); i++)
|
||
{
|
||
const TParameter ¶m = function.getParam(i);
|
||
if (param.name != 0)
|
||
{
|
||
TVariable *variable = new TVariable(param.name, *param.type);
|
||
|
||
prototype = parseContext->intermediate.growAggregate(prototype, parseContext->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), yyvsp[-1].interm.line), yyvsp[-1].interm.line);
|
||
}
|
||
else
|
||
{
|
||
prototype = parseContext->intermediate.growAggregate(prototype, parseContext->intermediate.addSymbol(0, "", *param.type, yyvsp[-1].interm.line), yyvsp[-1].interm.line);
|
||
}
|
||
}
|
||
|
||
prototype->setOp(EOpPrototype);
|
||
yyval.interm.intermNode = prototype;
|
||
;
|
||
break;}
|
||
case 71:
|
||
{
|
||
if (yyvsp[-1].interm.intermAggregate)
|
||
yyvsp[-1].interm.intermAggregate->setOp(EOpDeclaration);
|
||
yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate;
|
||
;
|
||
break;}
|
||
case 72:
|
||
{
|
||
parseContext->symbolTable.setDefaultPrecision( yyvsp[-1].interm.type.type, yyvsp[-2].interm.precision );
|
||
yyval.interm.intermNode = 0;
|
||
;
|
||
break;}
|
||
case 73:
|
||
{
|
||
//
|
||
// 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<TFunction*>(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->getParam(i).type->getQualifier() != yyvsp[-1].interm.function->getParam(i).type->getQualifier()) {
|
||
parseContext->error(yyvsp[0].lex.line, "overloaded functions must have the same parameter qualifiers", yyvsp[-1].interm.function->getParam(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 74:
|
||
{
|
||
yyval.interm.function = yyvsp[0].interm.function;
|
||
;
|
||
break;}
|
||
case 75:
|
||
{
|
||
yyval.interm.function = yyvsp[0].interm.function;
|
||
;
|
||
break;}
|
||
case 76:
|
||
{
|
||
// 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 77:
|
||
{
|
||
//
|
||
// 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 78:
|
||
{
|
||
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;
|
||
TType type(yyvsp[-2].interm.type);
|
||
function = new TFunction(yyvsp[-1].lex.string, type);
|
||
yyval.interm.function = function;
|
||
;
|
||
break;}
|
||
case 79:
|
||
{
|
||
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 80:
|
||
{
|
||
// Check that we can make an array out of this type
|
||
if (parseContext->arrayTypeErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
|
||
parseContext->recover();
|
||
|
||
if (parseContext->reservedErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string))
|
||
parseContext->recover();
|
||
|
||
int size;
|
||
if (parseContext->arraySizeErrorCheck(yyvsp[-2].lex.line, yyvsp[-1].interm.intermTypedNode, size))
|
||
parseContext->recover();
|
||
yyvsp[-4].interm.type.setArray(true, size);
|
||
|
||
TType* type = new TType(yyvsp[-4].interm.type);
|
||
TParameter param = { yyvsp[-3].lex.string, type };
|
||
yyval.interm.line = yyvsp[-3].lex.line;
|
||
yyval.interm.param = param;
|
||
;
|
||
break;}
|
||
case 81:
|
||
{
|
||
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 82:
|
||
{
|
||
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 83:
|
||
{
|
||
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 84:
|
||
{
|
||
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 85:
|
||
{
|
||
yyval.interm.qualifier = EvqIn;
|
||
;
|
||
break;}
|
||
case 86:
|
||
{
|
||
yyval.interm.qualifier = EvqIn;
|
||
;
|
||
break;}
|
||
case 87:
|
||
{
|
||
yyval.interm.qualifier = EvqOut;
|
||
;
|
||
break;}
|
||
case 88:
|
||
{
|
||
yyval.interm.qualifier = EvqInOut;
|
||
;
|
||
break;}
|
||
case 89:
|
||
{
|
||
TParameter param = { 0, new TType(yyvsp[0].interm.type) };
|
||
yyval.interm.param = param;
|
||
;
|
||
break;}
|
||
case 90:
|
||
{
|
||
yyval.interm = yyvsp[0].interm;
|
||
|
||
if (yyval.interm.type.precision == EbpUndefined) {
|
||
yyval.interm.type.precision = parseContext->symbolTable.getDefaultPrecision(yyvsp[0].interm.type.type);
|
||
if (parseContext->precisionErrorCheck(yyvsp[0].interm.line, yyval.interm.type.precision, yyvsp[0].interm.type.type)) {
|
||
parseContext->recover();
|
||
}
|
||
}
|
||
;
|
||
break;}
|
||
case 91:
|
||
{
|
||
yyval.interm.intermAggregate = parseContext->intermediate.growAggregate(yyvsp[-2].interm.intermNode, parseContext->intermediate.addSymbol(0, *yyvsp[0].lex.string, TType(yyvsp[-2].interm.type), yyvsp[0].lex.line), yyvsp[0].lex.line);
|
||
|
||
if (parseContext->structQualifierErrorCheck(yyvsp[0].lex.line, yyval.interm.type))
|
||
parseContext->recover();
|
||
|
||
if (parseContext->nonInitConstErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
|
||
parseContext->recover();
|
||
|
||
if (parseContext->nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
|
||
parseContext->recover();
|
||
;
|
||
break;}
|
||
case 92:
|
||
{
|
||
if (parseContext->structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
|
||
parseContext->recover();
|
||
|
||
if (parseContext->nonInitConstErrorCheck(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-4].interm.type))
|
||
parseContext->recover();
|
||
|
||
yyval.interm = yyvsp[-4].interm;
|
||
|
||
if (parseContext->arrayTypeErrorCheck(yyvsp[-1].lex.line, yyvsp[-4].interm.type) || parseContext->arrayQualifierErrorCheck(yyvsp[-1].lex.line, yyvsp[-4].interm.type))
|
||
parseContext->recover();
|
||
else {
|
||
yyvsp[-4].interm.type.setArray(true);
|
||
TVariable* variable;
|
||
if (parseContext->arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyvsp[-4].interm.type, variable))
|
||
parseContext->recover();
|
||
}
|
||
;
|
||
break;}
|
||
case 93:
|
||
{
|
||
if (parseContext->structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-5].interm.type))
|
||
parseContext->recover();
|
||
|
||
if (parseContext->nonInitConstErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string, yyvsp[-5].interm.type))
|
||
parseContext->recover();
|
||
|
||
yyval.interm = yyvsp[-5].interm;
|
||
|
||
if (parseContext->arrayTypeErrorCheck(yyvsp[-2].lex.line, yyvsp[-5].interm.type) || parseContext->arrayQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-5].interm.type))
|
||
parseContext->recover();
|
||
else {
|
||
int size;
|
||
if (parseContext->arraySizeErrorCheck(yyvsp[-2].lex.line, yyvsp[-1].interm.intermTypedNode, size))
|
||
parseContext->recover();
|
||
yyvsp[-5].interm.type.setArray(true, size);
|
||
TVariable* variable;
|
||
if (parseContext->arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyvsp[-5].interm.type, variable))
|
||
parseContext->recover();
|
||
TType type = TType(yyvsp[-5].interm.type);
|
||
type.setArraySize(size);
|
||
yyval.interm.intermAggregate = parseContext->intermediate.growAggregate(yyvsp[-5].interm.intermNode, parseContext->intermediate.addSymbol(0, *yyvsp[-3].lex.string, type, yyvsp[-3].lex.line), yyvsp[-3].lex.line);
|
||
}
|
||
;
|
||
break;}
|
||
case 94:
|
||
{
|
||
if (parseContext->structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
|
||
parseContext->recover();
|
||
|
||
yyval.interm = yyvsp[-4].interm;
|
||
|
||
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 95:
|
||
{
|
||
yyval.interm.type = yyvsp[0].interm.type;
|
||
yyval.interm.intermAggregate = parseContext->intermediate.makeAggregate(parseContext->intermediate.addSymbol(0, "", TType(yyvsp[0].interm.type), yyvsp[0].interm.type.line), yyvsp[0].interm.type.line);
|
||
;
|
||
break;}
|
||
case 96:
|
||
{
|
||
yyval.interm.intermAggregate = parseContext->intermediate.makeAggregate(parseContext->intermediate.addSymbol(0, *yyvsp[0].lex.string, TType(yyvsp[-1].interm.type), yyvsp[0].lex.line), yyvsp[0].lex.line);
|
||
|
||
if (parseContext->structQualifierErrorCheck(yyvsp[0].lex.line, yyval.interm.type))
|
||
parseContext->recover();
|
||
|
||
if (parseContext->nonInitConstErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
|
||
parseContext->recover();
|
||
|
||
yyval.interm.type = yyvsp[-1].interm.type;
|
||
|
||
if (parseContext->nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
|
||
parseContext->recover();
|
||
;
|
||
break;}
|
||
case 97:
|
||
{
|
||
yyval.interm.intermAggregate = parseContext->intermediate.makeAggregate(parseContext->intermediate.addSymbol(0, *yyvsp[-2].lex.string, TType(yyvsp[-3].interm.type), yyvsp[-2].lex.line), yyvsp[-2].lex.line);
|
||
|
||
if (parseContext->structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
|
||
parseContext->recover();
|
||
|
||
if (parseContext->nonInitConstErrorCheck(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type))
|
||
parseContext->recover();
|
||
|
||
yyval.interm.type = yyvsp[-3].interm.type;
|
||
|
||
if (parseContext->arrayTypeErrorCheck(yyvsp[-1].lex.line, yyvsp[-3].interm.type) || parseContext->arrayQualifierErrorCheck(yyvsp[-1].lex.line, yyvsp[-3].interm.type))
|
||
parseContext->recover();
|
||
else {
|
||
yyvsp[-3].interm.type.setArray(true);
|
||
TVariable* variable;
|
||
if (parseContext->arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, variable))
|
||
parseContext->recover();
|
||
}
|
||
;
|
||
break;}
|
||
case 98:
|
||
{
|
||
TType type = TType(yyvsp[-4].interm.type);
|
||
int size;
|
||
if (parseContext->arraySizeErrorCheck(yyvsp[-3].lex.line, yyvsp[-1].interm.intermTypedNode, size))
|
||
parseContext->recover();
|
||
type.setArraySize(size);
|
||
yyval.interm.intermAggregate = parseContext->intermediate.makeAggregate(parseContext->intermediate.addSymbol(0, *yyvsp[-3].lex.string, type, yyvsp[-3].lex.line), yyvsp[-3].lex.line);
|
||
|
||
if (parseContext->structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.type))
|
||
parseContext->recover();
|
||
|
||
if (parseContext->nonInitConstErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string, yyvsp[-4].interm.type))
|
||
parseContext->recover();
|
||
|
||
yyval.interm.type = yyvsp[-4].interm.type;
|
||
|
||
if (parseContext->arrayTypeErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type) || parseContext->arrayQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
|
||
parseContext->recover();
|
||
else {
|
||
int size;
|
||
if (parseContext->arraySizeErrorCheck(yyvsp[-2].lex.line, yyvsp[-1].interm.intermTypedNode, size))
|
||
parseContext->recover();
|
||
|
||
yyvsp[-4].interm.type.setArray(true, size);
|
||
TVariable* variable;
|
||
if (parseContext->arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyvsp[-4].interm.type, variable))
|
||
parseContext->recover();
|
||
}
|
||
;
|
||
break;}
|
||
case 99:
|
||
{
|
||
if (parseContext->structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
|
||
parseContext->recover();
|
||
|
||
yyval.interm.type = yyvsp[-3].interm.type;
|
||
|
||
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 100:
|
||
{
|
||
VERTEX_ONLY("invariant declaration", yyvsp[-1].lex.line);
|
||
yyval.interm.qualifier = EvqInvariantVaryingOut;
|
||
yyval.interm.intermAggregate = 0;
|
||
;
|
||
break;}
|
||
case 101:
|
||
{
|
||
yyval.interm.type = yyvsp[0].interm.type;
|
||
|
||
if (yyvsp[0].interm.type.array) {
|
||
parseContext->error(yyvsp[0].interm.type.line, "not supported", "first-class array", "");
|
||
parseContext->recover();
|
||
yyvsp[0].interm.type.setArray(false);
|
||
}
|
||
;
|
||
break;}
|
||
case 102:
|
||
{
|
||
if (yyvsp[0].interm.type.array) {
|
||
parseContext->error(yyvsp[0].interm.type.line, "not supported", "first-class array", "");
|
||
parseContext->recover();
|
||
yyvsp[0].interm.type.setArray(false);
|
||
}
|
||
|
||
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 = yyvsp[0].interm.type;
|
||
yyval.interm.type.qualifier = yyvsp[-1].interm.type.qualifier;
|
||
;
|
||
break;}
|
||
case 103:
|
||
{
|
||
yyval.interm.type.setBasic(EbtVoid, EvqConst, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 104:
|
||
{
|
||
VERTEX_ONLY("attribute", yyvsp[0].lex.line);
|
||
if (parseContext->globalErrorCheck(yyvsp[0].lex.line, parseContext->symbolTable.atGlobalLevel(), "attribute"))
|
||
parseContext->recover();
|
||
yyval.interm.type.setBasic(EbtVoid, EvqAttribute, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 105:
|
||
{
|
||
if (parseContext->globalErrorCheck(yyvsp[0].lex.line, parseContext->symbolTable.atGlobalLevel(), "varying"))
|
||
parseContext->recover();
|
||
if (parseContext->shaderType == SH_VERTEX_SHADER)
|
||
yyval.interm.type.setBasic(EbtVoid, EvqVaryingOut, yyvsp[0].lex.line);
|
||
else
|
||
yyval.interm.type.setBasic(EbtVoid, EvqVaryingIn, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 106:
|
||
{
|
||
if (parseContext->globalErrorCheck(yyvsp[-1].lex.line, parseContext->symbolTable.atGlobalLevel(), "invariant varying"))
|
||
parseContext->recover();
|
||
if (parseContext->shaderType == SH_VERTEX_SHADER)
|
||
yyval.interm.type.setBasic(EbtVoid, EvqInvariantVaryingOut, yyvsp[-1].lex.line);
|
||
else
|
||
yyval.interm.type.setBasic(EbtVoid, EvqInvariantVaryingIn, yyvsp[-1].lex.line);
|
||
;
|
||
break;}
|
||
case 107:
|
||
{
|
||
if (parseContext->globalErrorCheck(yyvsp[0].lex.line, parseContext->symbolTable.atGlobalLevel(), "uniform"))
|
||
parseContext->recover();
|
||
yyval.interm.type.setBasic(EbtVoid, EvqUniform, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 108:
|
||
{
|
||
yyval.interm.type = yyvsp[0].interm.type;
|
||
;
|
||
break;}
|
||
case 109:
|
||
{
|
||
yyval.interm.type = yyvsp[0].interm.type;
|
||
yyval.interm.type.precision = yyvsp[-1].interm.precision;
|
||
;
|
||
break;}
|
||
case 110:
|
||
{
|
||
yyval.interm.precision = EbpHigh;
|
||
;
|
||
break;}
|
||
case 111:
|
||
{
|
||
yyval.interm.precision = EbpMedium;
|
||
;
|
||
break;}
|
||
case 112:
|
||
{
|
||
yyval.interm.precision = EbpLow;
|
||
;
|
||
break;}
|
||
case 113:
|
||
{
|
||
yyval.interm.type = yyvsp[0].interm.type;
|
||
;
|
||
break;}
|
||
case 114:
|
||
{
|
||
yyval.interm.type = yyvsp[-3].interm.type;
|
||
|
||
if (parseContext->arrayTypeErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
|
||
parseContext->recover();
|
||
else {
|
||
int size;
|
||
if (parseContext->arraySizeErrorCheck(yyvsp[-2].lex.line, yyvsp[-1].interm.intermTypedNode, size))
|
||
parseContext->recover();
|
||
yyval.interm.type.setArray(true, size);
|
||
}
|
||
;
|
||
break;}
|
||
case 115:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtVoid, qual, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 116:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtFloat, qual, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 117:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtInt, qual, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 118:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtBool, qual, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 119:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtFloat, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(2);
|
||
;
|
||
break;}
|
||
case 120:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtFloat, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(3);
|
||
;
|
||
break;}
|
||
case 121:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtFloat, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(4);
|
||
;
|
||
break;}
|
||
case 122:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtBool, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(2);
|
||
;
|
||
break;}
|
||
case 123:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtBool, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(3);
|
||
;
|
||
break;}
|
||
case 124:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtBool, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(4);
|
||
;
|
||
break;}
|
||
case 125:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtInt, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(2);
|
||
;
|
||
break;}
|
||
case 126:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtInt, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(3);
|
||
;
|
||
break;}
|
||
case 127:
|
||
{
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtInt, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(4);
|
||
;
|
||
break;}
|
||
case 128:
|
||
{
|
||
FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line);
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtFloat, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(2, true);
|
||
;
|
||
break;}
|
||
case 129:
|
||
{
|
||
FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line);
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtFloat, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(3, true);
|
||
;
|
||
break;}
|
||
case 130:
|
||
{
|
||
FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line);
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtFloat, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.setAggregate(4, true);
|
||
;
|
||
break;}
|
||
case 131:
|
||
{
|
||
FRAG_VERT_ONLY("sampler2D", yyvsp[0].lex.line);
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtSampler2D, qual, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 132:
|
||
{
|
||
FRAG_VERT_ONLY("samplerCube", yyvsp[0].lex.line);
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtSamplerCube, qual, yyvsp[0].lex.line);
|
||
;
|
||
break;}
|
||
case 133:
|
||
{
|
||
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 134:
|
||
{
|
||
//
|
||
// This is for user defined type names. The lexical phase looked up the
|
||
// type.
|
||
//
|
||
TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();
|
||
TQualifier qual = parseContext->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||
yyval.interm.type.setBasic(EbtStruct, qual, yyvsp[0].lex.line);
|
||
yyval.interm.type.userDef = &structure;
|
||
;
|
||
break;}
|
||
case 135:
|
||
{
|
||
if (parseContext->reservedErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string))
|
||
parseContext->recover();
|
||
|
||
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();
|
||
}
|
||
yyval.interm.type.setBasic(EbtStruct, EvqTemporary, yyvsp[-4].lex.line);
|
||
yyval.interm.type.userDef = structure;
|
||
;
|
||
break;}
|
||
case 136:
|
||
{
|
||
TType* structure = new TType(yyvsp[-1].interm.typeList, TString(""));
|
||
yyval.interm.type.setBasic(EbtStruct, EvqTemporary, yyvsp[-3].lex.line);
|
||
yyval.interm.type.userDef = structure;
|
||
;
|
||
break;}
|
||
case 137:
|
||
{
|
||
yyval.interm.typeList = yyvsp[0].interm.typeList;
|
||
;
|
||
break;}
|
||
case 138:
|
||
{
|
||
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 139:
|
||
{
|
||
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 known aspects of type, like array-ness
|
||
//
|
||
TType* type = (*yyval.interm.typeList)[i].type;
|
||
type->setBasicType(yyvsp[-2].interm.type.type);
|
||
type->setNominalSize(yyvsp[-2].interm.type.size);
|
||
type->setMatrix(yyvsp[-2].interm.type.matrix);
|
||
|
||
// don't allow arrays of arrays
|
||
if (type->isArray()) {
|
||
if (parseContext->arrayTypeErrorCheck(yyvsp[-2].interm.type.line, yyvsp[-2].interm.type))
|
||
parseContext->recover();
|
||
}
|
||
if (yyvsp[-2].interm.type.array)
|
||
type->setArraySize(yyvsp[-2].interm.type.arraySize);
|
||
if (yyvsp[-2].interm.type.userDef) {
|
||
type->setStruct(yyvsp[-2].interm.type.userDef->getStruct());
|
||
type->setTypeName(yyvsp[-2].interm.type.userDef->getTypeName());
|
||
}
|
||
}
|
||
;
|
||
break;}
|
||
case 140:
|
||
{
|
||
yyval.interm.typeList = NewPoolTTypeList();
|
||
yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);
|
||
;
|
||
break;}
|
||
case 141:
|
||
{
|
||
yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);
|
||
;
|
||
break;}
|
||
case 142:
|
||
{
|
||
if (parseContext->reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
|
||
parseContext->recover();
|
||
|
||
yyval.interm.typeLine.type = new TType(EbtVoid, EbpUndefined);
|
||
yyval.interm.typeLine.line = yyvsp[0].lex.line;
|
||
yyval.interm.typeLine.type->setFieldName(*yyvsp[0].lex.string);
|
||
;
|
||
break;}
|
||
case 143:
|
||
{
|
||
if (parseContext->reservedErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string))
|
||
parseContext->recover();
|
||
|
||
yyval.interm.typeLine.type = new TType(EbtVoid, EbpUndefined);
|
||
yyval.interm.typeLine.line = yyvsp[-3].lex.line;
|
||
yyval.interm.typeLine.type->setFieldName(*yyvsp[-3].lex.string);
|
||
|
||
int size;
|
||
if (parseContext->arraySizeErrorCheck(yyvsp[-2].lex.line, yyvsp[-1].interm.intermTypedNode, size))
|
||
parseContext->recover();
|
||
yyval.interm.typeLine.type->setArraySize(size);
|
||
;
|
||
break;}
|
||
case 144:
|
||
{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;
|
||
break;}
|
||
case 145:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 146:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermAggregate; ;
|
||
break;}
|
||
case 147:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 148:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 149:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 150:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 151:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 152:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 153:
|
||
{ yyval.interm.intermAggregate = 0; ;
|
||
break;}
|
||
case 154:
|
||
{ parseContext->symbolTable.push(); ;
|
||
break;}
|
||
case 155:
|
||
{ parseContext->symbolTable.pop(); ;
|
||
break;}
|
||
case 156:
|
||
{
|
||
if (yyvsp[-2].interm.intermAggregate != 0)
|
||
yyvsp[-2].interm.intermAggregate->setOp(EOpSequence);
|
||
yyval.interm.intermAggregate = yyvsp[-2].interm.intermAggregate;
|
||
;
|
||
break;}
|
||
case 157:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 158:
|
||
{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;
|
||
break;}
|
||
case 159:
|
||
{
|
||
yyval.interm.intermNode = 0;
|
||
;
|
||
break;}
|
||
case 160:
|
||
{
|
||
if (yyvsp[-1].interm.intermAggregate)
|
||
yyvsp[-1].interm.intermAggregate->setOp(EOpSequence);
|
||
yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate;
|
||
;
|
||
break;}
|
||
case 161:
|
||
{
|
||
yyval.interm.intermAggregate = parseContext->intermediate.makeAggregate(yyvsp[0].interm.intermNode, 0);
|
||
;
|
||
break;}
|
||
case 162:
|
||
{
|
||
yyval.interm.intermAggregate = parseContext->intermediate.growAggregate(yyvsp[-1].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);
|
||
;
|
||
break;}
|
||
case 163:
|
||
{ yyval.interm.intermNode = 0; ;
|
||
break;}
|
||
case 164:
|
||
{ yyval.interm.intermNode = static_cast<TIntermNode*>(yyvsp[-1].interm.intermTypedNode); ;
|
||
break;}
|
||
case 165:
|
||
{
|
||
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 166:
|
||
{
|
||
yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermNode;
|
||
yyval.interm.nodePair.node2 = yyvsp[0].interm.intermNode;
|
||
;
|
||
break;}
|
||
case 167:
|
||
{
|
||
yyval.interm.nodePair.node1 = yyvsp[0].interm.intermNode;
|
||
yyval.interm.nodePair.node2 = 0;
|
||
;
|
||
break;}
|
||
case 168:
|
||
{
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
if (parseContext->boolErrorCheck(yyvsp[0].interm.intermTypedNode->getLine(), yyvsp[0].interm.intermTypedNode))
|
||
parseContext->recover();
|
||
;
|
||
break;}
|
||
case 169:
|
||
{
|
||
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 170:
|
||
{ parseContext->symbolTable.push(); ++parseContext->loopNestingLevel; ;
|
||
break;}
|
||
case 171:
|
||
{
|
||
parseContext->symbolTable.pop();
|
||
yyval.interm.intermNode = parseContext->intermediate.addLoop(0, yyvsp[0].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, true, yyvsp[-5].lex.line);
|
||
--parseContext->loopNestingLevel;
|
||
;
|
||
break;}
|
||
case 172:
|
||
{ ++parseContext->loopNestingLevel; ;
|
||
break;}
|
||
case 173:
|
||
{
|
||
if (parseContext->boolErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.intermTypedNode))
|
||
parseContext->recover();
|
||
|
||
yyval.interm.intermNode = parseContext->intermediate.addLoop(0, yyvsp[-5].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, false, yyvsp[-4].lex.line);
|
||
--parseContext->loopNestingLevel;
|
||
;
|
||
break;}
|
||
case 174:
|
||
{ parseContext->symbolTable.push(); ++parseContext->loopNestingLevel; ;
|
||
break;}
|
||
case 175:
|
||
{
|
||
parseContext->symbolTable.pop();
|
||
yyval.interm.intermNode = parseContext->intermediate.addLoop(yyvsp[-3].interm.intermNode, yyvsp[0].interm.intermNode, reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node1), reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node2), true, yyvsp[-6].lex.line);
|
||
--parseContext->loopNestingLevel;
|
||
;
|
||
break;}
|
||
case 176:
|
||
{
|
||
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
|
||
;
|
||
break;}
|
||
case 177:
|
||
{
|
||
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
|
||
;
|
||
break;}
|
||
case 178:
|
||
{
|
||
yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 179:
|
||
{
|
||
yyval.interm.intermTypedNode = 0;
|
||
;
|
||
break;}
|
||
case 180:
|
||
{
|
||
yyval.interm.nodePair.node1 = yyvsp[-1].interm.intermTypedNode;
|
||
yyval.interm.nodePair.node2 = 0;
|
||
;
|
||
break;}
|
||
case 181:
|
||
{
|
||
yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermTypedNode;
|
||
yyval.interm.nodePair.node2 = yyvsp[0].interm.intermTypedNode;
|
||
;
|
||
break;}
|
||
case 182:
|
||
{
|
||
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 183:
|
||
{
|
||
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 184:
|
||
{
|
||
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 185:
|
||
{
|
||
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 186:
|
||
{
|
||
FRAG_ONLY("discard", yyvsp[-1].lex.line);
|
||
yyval.interm.intermNode = parseContext->intermediate.addBranch(EOpKill, yyvsp[-1].lex.line);
|
||
;
|
||
break;}
|
||
case 187:
|
||
{
|
||
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
|
||
parseContext->treeRoot = yyval.interm.intermNode;
|
||
;
|
||
break;}
|
||
case 188:
|
||
{
|
||
yyval.interm.intermNode = parseContext->intermediate.growAggregate(yyvsp[-1].interm.intermNode, yyvsp[0].interm.intermNode, 0);
|
||
parseContext->treeRoot = yyval.interm.intermNode;
|
||
;
|
||
break;}
|
||
case 189:
|
||
{
|
||
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
|
||
;
|
||
break;}
|
||
case 190:
|
||
{
|
||
yyval.interm.intermNode = yyvsp[0].interm.intermNode;
|
||
;
|
||
break;}
|
||
case 191:
|
||
{
|
||
TFunction* function = yyvsp[0].interm.function;
|
||
TFunction* prevDec = static_cast<TFunction*>(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++) {
|
||
const TParameter& param = function->getParam(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;
|
||
}
|
||
|
||
//
|
||
// 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 192:
|
||
{
|
||
//?? 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());
|
||
|
||
// store the pragma information for debug and optimize and other vendor specific
|
||
// information. This information can be queried from the parse tree
|
||
yyval.interm.intermNode->getAsAggregate()->setOptimize(parseContext->contextPragma.optimize);
|
||
yyval.interm.intermNode->getAsAggregate()->setDebug(parseContext->contextPragma.debug);
|
||
yyval.interm.intermNode->getAsAggregate()->addToPragmaTable(parseContext->contextPragma.pragmaTable);
|
||
;
|
||
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;
|
||
}
|
||
|