summaryrefslogtreecommitdiff
path: root/dist/Mesa/src/glsl/glcpp/glcpp-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'dist/Mesa/src/glsl/glcpp/glcpp-parse.c')
-rw-r--r--dist/Mesa/src/glsl/glcpp/glcpp-parse.c1783
1 files changed, 721 insertions, 1062 deletions
diff --git a/dist/Mesa/src/glsl/glcpp/glcpp-parse.c b/dist/Mesa/src/glsl/glcpp/glcpp-parse.c
index b7d51ea45..a131a824e 100644
--- a/dist/Mesa/src/glsl/glcpp/glcpp-parse.c
+++ b/dist/Mesa/src/glsl/glcpp/glcpp-parse.c
@@ -128,9 +128,6 @@ _string_list_append_item (string_list_t *list, const char *str);
static int
_string_list_contains (string_list_t *list, const char *member, int *index);
-static const char *
-_string_list_has_duplicate (string_list_t *list);
-
static int
_string_list_length (string_list_t *list);
@@ -179,25 +176,18 @@ _parser_active_list_pop (glcpp_parser_t *parser);
static int
_parser_active_list_contains (glcpp_parser_t *parser, const char *identifier);
-typedef enum {
- EXPANSION_MODE_IGNORE_DEFINED,
- EXPANSION_MODE_EVALUATE_DEFINED
-} expansion_mode_t;
-
/* Expand list, and begin lexing from the result (after first
* prefixing a token of type 'head_token_type').
*/
static void
_glcpp_parser_expand_and_lex_from (glcpp_parser_t *parser,
int head_token_type,
- token_list_t *list,
- expansion_mode_t mode);
+ token_list_t *list);
/* Perform macro expansion in-place on the given list. */
static void
_glcpp_parser_expand_token_list (glcpp_parser_t *parser,
- token_list_t *list,
- expansion_mode_t mode);
+ token_list_t *list);
static void
_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser,
@@ -228,7 +218,7 @@ static void
add_builtin_define(glcpp_parser_t *parser, const char *name, int value);
-#line 232 "glcpp/glcpp-parse.c" /* yacc.c:339 */
+#line 222 "glcpp/glcpp-parse.c" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -252,7 +242,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value);
# define YY_GLCPP_PARSER_SRC_GLSL_GLCPP_GLCPP_PARSE_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
-# define YYDEBUG 1
+# define YYDEBUG 0
#endif
#if YYDEBUG
extern int glcpp_parser_debug;
@@ -263,45 +253,41 @@ extern int glcpp_parser_debug;
# define YYTOKENTYPE
enum yytokentype
{
- DEFINED = 258,
- ELIF_EXPANDED = 259,
- HASH_TOKEN = 260,
- DEFINE_TOKEN = 261,
- FUNC_IDENTIFIER = 262,
- OBJ_IDENTIFIER = 263,
- ELIF = 264,
- ELSE = 265,
- ENDIF = 266,
- ERROR_TOKEN = 267,
- IF = 268,
- IFDEF = 269,
- IFNDEF = 270,
- LINE = 271,
- PRAGMA = 272,
- UNDEF = 273,
- VERSION_TOKEN = 274,
- GARBAGE = 275,
- IDENTIFIER = 276,
- IF_EXPANDED = 277,
- INTEGER = 278,
- INTEGER_STRING = 279,
- LINE_EXPANDED = 280,
- NEWLINE = 281,
- OTHER = 282,
- PLACEHOLDER = 283,
- SPACE = 284,
- PLUS_PLUS = 285,
- MINUS_MINUS = 286,
- PASTE = 287,
- OR = 288,
- AND = 289,
- EQUAL = 290,
- NOT_EQUAL = 291,
- LESS_OR_EQUAL = 292,
- GREATER_OR_EQUAL = 293,
- LEFT_SHIFT = 294,
- RIGHT_SHIFT = 295,
- UNARY = 296
+ COMMA_FINAL = 258,
+ DEFINED = 259,
+ ELIF_EXPANDED = 260,
+ HASH = 261,
+ HASH_DEFINE = 262,
+ FUNC_IDENTIFIER = 263,
+ OBJ_IDENTIFIER = 264,
+ HASH_ELIF = 265,
+ HASH_ELSE = 266,
+ HASH_ENDIF = 267,
+ HASH_IF = 268,
+ HASH_IFDEF = 269,
+ HASH_IFNDEF = 270,
+ HASH_LINE = 271,
+ HASH_UNDEF = 272,
+ HASH_VERSION = 273,
+ IDENTIFIER = 274,
+ IF_EXPANDED = 275,
+ INTEGER = 276,
+ INTEGER_STRING = 277,
+ LINE_EXPANDED = 278,
+ NEWLINE = 279,
+ OTHER = 280,
+ PLACEHOLDER = 281,
+ SPACE = 282,
+ PASTE = 283,
+ OR = 284,
+ AND = 285,
+ EQUAL = 286,
+ NOT_EQUAL = 287,
+ LESS_OR_EQUAL = 288,
+ GREATER_OR_EQUAL = 289,
+ LEFT_SHIFT = 290,
+ RIGHT_SHIFT = 291,
+ UNARY = 292
};
#endif
@@ -329,7 +315,7 @@ int glcpp_parser_parse (glcpp_parser_t *parser);
/* Copy the second part of user declarations. */
-#line 333 "glcpp/glcpp-parse.c" /* yacc.c:358 */
+#line 319 "glcpp/glcpp-parse.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -573,21 +559,21 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 652
+#define YYLAST 695
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 64
+#define YYNTOKENS 60
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 25
+#define YYNNTS 26
/* YYNRULES -- Number of rules. */
-#define YYNRULES 118
+#define YYNRULES 115
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 185
+#define YYNSTATES 181
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 296
+#define YYMAXUTOK 292
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -599,16 +585,16 @@ static const yytype_uint8 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, 54, 2, 2, 2, 50, 37, 2,
- 52, 53, 48, 46, 56, 47, 61, 49, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 62,
- 40, 63, 41, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 50, 2, 2, 2, 46, 33, 2,
+ 48, 49, 44, 42, 52, 43, 57, 45, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 58,
+ 36, 59, 37, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 57, 2, 58, 36, 2, 2, 2, 2, 2,
+ 2, 53, 2, 54, 32, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 59, 35, 60, 55, 2, 2, 2,
+ 2, 2, 2, 55, 31, 56, 51, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -624,26 +610,26 @@ static const yytype_uint8 yytranslate[] =
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,
- 38, 39, 42, 43, 44, 45, 51
+ 25, 26, 27, 28, 29, 30, 34, 35, 38, 39,
+ 40, 41, 47
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 205, 205, 207, 211, 212, 213, 218, 222, 227,
- 232, 240, 253, 256, 259, 265, 268, 269, 269, 284,
- 284, 287, 287, 304, 304, 327, 337, 337, 344, 344,
- 351, 377, 397, 397, 410, 410, 413, 419, 425, 428,
- 434, 437, 440, 446, 455, 460, 464, 471, 482, 493,
- 500, 507, 514, 521, 528, 535, 542, 549, 556, 563,
- 570, 577, 584, 596, 608, 615, 619, 623, 627, 631,
- 637, 642, 650, 651, 655, 656, 659, 661, 667, 672,
- 679, 683, 687, 691, 695, 699, 706, 707, 708, 709,
- 710, 711, 712, 713, 714, 715, 716, 717, 718, 719,
- 720, 721, 722, 723, 724, 725, 726, 727, 728, 729,
- 730, 731, 732, 733, 734, 735, 736, 737, 738
+ 0, 188, 188, 190, 194, 197, 197, 208, 213, 214,
+ 218, 221, 224, 232, 245, 248, 251, 257, 257, 260,
+ 260, 270, 270, 292, 302, 302, 309, 309, 316, 341,
+ 361, 361, 374, 374, 377, 383, 389, 395, 404, 409,
+ 410, 415, 418, 421, 424, 427, 430, 433, 436, 439,
+ 442, 445, 448, 451, 454, 457, 460, 468, 476, 479,
+ 482, 485, 488, 491, 497, 502, 510, 511, 515, 521,
+ 522, 525, 527, 534, 538, 542, 547, 551, 558, 563,
+ 570, 574, 578, 582, 586, 593, 594, 595, 596, 597,
+ 598, 599, 600, 601, 602, 603, 604, 605, 606, 607,
+ 608, 609, 610, 611, 612, 613, 614, 615, 616, 617,
+ 618, 619, 620, 621, 622, 623
};
#endif
@@ -652,21 +638,21 @@ static const yytype_uint16 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "DEFINED", "ELIF_EXPANDED", "HASH_TOKEN",
- "DEFINE_TOKEN", "FUNC_IDENTIFIER", "OBJ_IDENTIFIER", "ELIF", "ELSE",
- "ENDIF", "ERROR_TOKEN", "IF", "IFDEF", "IFNDEF", "LINE", "PRAGMA",
- "UNDEF", "VERSION_TOKEN", "GARBAGE", "IDENTIFIER", "IF_EXPANDED",
- "INTEGER", "INTEGER_STRING", "LINE_EXPANDED", "NEWLINE", "OTHER",
- "PLACEHOLDER", "SPACE", "PLUS_PLUS", "MINUS_MINUS", "PASTE", "OR", "AND",
- "'|'", "'^'", "'&'", "EQUAL", "NOT_EQUAL", "'<'", "'>'", "LESS_OR_EQUAL",
- "GREATER_OR_EQUAL", "LEFT_SHIFT", "RIGHT_SHIFT", "'+'", "'-'", "'*'",
- "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'", "','", "'['", "']'",
- "'{'", "'}'", "'.'", "';'", "'='", "$accept", "input", "line",
- "expanded_line", "define", "control_line", "$@1", "control_line_success",
- "$@2", "$@3", "$@4", "$@5", "$@6", "$@7", "$@8", "control_line_error",
- "integer_constant", "expression", "identifier_list", "text_line",
- "replacement_list", "junk", "pp_tokens", "preprocessing_token",
- "operator", YY_NULLPTR
+ "$end", "error", "$undefined", "COMMA_FINAL", "DEFINED",
+ "ELIF_EXPANDED", "HASH", "HASH_DEFINE", "FUNC_IDENTIFIER",
+ "OBJ_IDENTIFIER", "HASH_ELIF", "HASH_ELSE", "HASH_ENDIF", "HASH_IF",
+ "HASH_IFDEF", "HASH_IFNDEF", "HASH_LINE", "HASH_UNDEF", "HASH_VERSION",
+ "IDENTIFIER", "IF_EXPANDED", "INTEGER", "INTEGER_STRING",
+ "LINE_EXPANDED", "NEWLINE", "OTHER", "PLACEHOLDER", "SPACE", "PASTE",
+ "OR", "AND", "'|'", "'^'", "'&'", "EQUAL", "NOT_EQUAL", "'<'", "'>'",
+ "LESS_OR_EQUAL", "GREATER_OR_EQUAL", "LEFT_SHIFT", "RIGHT_SHIFT", "'+'",
+ "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'", "','",
+ "'['", "']'", "'{'", "'}'", "'.'", "';'", "'='", "$accept", "input",
+ "line", "$@1", "expanded_line", "define", "control_line", "$@2", "$@3",
+ "$@4", "$@5", "$@6", "$@7", "$@8", "integer_constant", "expression",
+ "identifier_list", "text_line", "non_directive", "replacement_list",
+ "junk", "conditional_token", "conditional_tokens", "pp_tokens",
+ "preprocessing_token", "operator", YY_NULLPTR
};
#endif
@@ -678,17 +664,16 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 124, 94, 38, 290, 291,
- 60, 62, 292, 293, 294, 295, 43, 45, 42, 47,
- 37, 296, 40, 41, 33, 126, 44, 91, 93, 123,
- 125, 46, 59, 61
+ 285, 124, 94, 38, 286, 287, 60, 62, 288, 289,
+ 290, 291, 43, 45, 42, 47, 37, 292, 40, 41,
+ 33, 126, 44, 91, 93, 123, 125, 46, 59, 61
};
# endif
-#define YYPACT_NINF -142
+#define YYPACT_NINF -166
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-142)))
+ (!!((Yystate) == (-166)))
#define YYTABLE_NINF -1
@@ -699,25 +684,25 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- -142, 134, -142, -142, -18, 578, -142, -18, -142, -15,
- -142, -142, 26, -142, -142, -142, -142, -142, -142, -142,
- -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
- -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
- -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
- -142, -142, 182, -142, -142, -142, -142, -142, -18, -18,
- -18, -18, -18, -142, 508, 7, 230, -142, -142, 9,
- 25, -142, -142, -142, 35, -142, -15, 470, -142, 533,
- 81, -142, -142, -142, -142, -142, -142, -23, -142, -142,
- -142, -18, -18, -18, -18, -18, -18, -18, -18, -18,
- -18, -18, -18, -18, -18, -18, -18, -18, -18, -142,
- 65, -142, 278, 38, 58, -142, -142, 470, 90, 91,
- 470, -142, 92, 37, 326, -142, -142, 89, -142, 571,
- 587, 602, 83, 102, 0, 0, 33, 33, 33, 33,
- 20, 20, 60, 60, -142, -142, -142, 66, 470, -142,
- -142, -142, -142, 374, 470, 470, 422, 109, 110, -142,
- -142, -142, -14, 131, 470, -142, 136, 470, 172, -142,
- -142, -142, -142, 470, 4, -142, -142, -142, 173, 470,
- 179, -142, 175, -142, -142
+ -166, 147, -166, 87, -10, -166, 190, -166, -166, -17,
+ -166, -166, -166, -166, 52, -166, 87, -166, 52, -166,
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+ -166, -166, -166, -166, -166, -166, -166, 360, -166, -166,
+ -166, -166, -166, 87, 87, 87, 87, 87, -166, 519,
+ -166, -166, 401, 105, 31, -166, -166, 233, -166, 34,
+ 44, -166, 319, 67, 86, 483, 88, -8, 542, 48,
+ -166, -166, -166, -166, 560, -166, -166, -166, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, -166, -35, 483, -166,
+ -166, 96, -166, -166, -166, -166, 276, 483, 483, 442,
+ 92, 93, -166, -166, -166, 94, -166, 580, 596, 611,
+ 625, 638, 649, 649, 19, 19, 19, 19, 38, 38,
+ 66, 66, -166, -166, -166, 18, 95, 483, 72, -166,
+ 98, 483, 100, -166, -166, -166, -166, -166, 483, 26,
+ -166, -166, -166, -166, 101, 483, 107, -166, 108, -166,
+ -166
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -725,41 +710,41 @@ static const yytype_int16 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 83, 0, 0, 80, 0, 81, 0,
- 72, 84, 85, 117, 118, 116, 112, 111, 110, 109,
- 93, 107, 108, 103, 104, 105, 106, 101, 102, 95,
- 96, 94, 99, 100, 88, 89, 98, 97, 114, 86,
- 87, 90, 91, 92, 113, 115, 3, 7, 4, 15,
- 16, 6, 0, 78, 82, 46, 44, 43, 0, 0,
- 0, 0, 0, 45, 0, 19, 0, 32, 34, 0,
- 23, 26, 28, 17, 0, 21, 0, 0, 38, 0,
- 0, 5, 73, 85, 79, 68, 67, 0, 65, 66,
- 9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 41,
- 0, 31, 0, 0, 0, 40, 25, 0, 0, 0,
- 0, 39, 0, 0, 0, 8, 10, 0, 69, 47,
- 48, 49, 50, 51, 53, 52, 57, 56, 55, 54,
- 59, 58, 61, 60, 64, 63, 62, 0, 74, 20,
- 30, 33, 35, 0, 76, 76, 0, 0, 0, 36,
- 42, 11, 0, 0, 75, 24, 0, 77, 0, 18,
- 22, 37, 70, 74, 0, 12, 27, 29, 0, 74,
- 0, 13, 0, 71, 14
+ 2, 0, 1, 0, 0, 17, 0, 30, 32, 21,
+ 24, 26, 5, 19, 0, 80, 0, 81, 0, 66,
+ 83, 84, 115, 111, 110, 109, 108, 92, 106, 107,
+ 102, 103, 104, 105, 100, 101, 94, 95, 93, 98,
+ 99, 87, 88, 97, 96, 113, 85, 86, 89, 90,
+ 91, 112, 114, 3, 8, 4, 7, 0, 78, 82,
+ 40, 38, 37, 0, 0, 0, 0, 0, 39, 0,
+ 36, 9, 0, 0, 0, 29, 76, 0, 75, 0,
+ 0, 23, 0, 0, 0, 0, 0, 0, 0, 0,
+ 67, 79, 62, 61, 0, 59, 60, 11, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 68, 0, 69, 18,
+ 73, 0, 28, 77, 31, 33, 0, 71, 71, 0,
+ 0, 0, 34, 10, 12, 0, 63, 41, 42, 43,
+ 44, 45, 47, 46, 51, 50, 49, 48, 53, 52,
+ 55, 54, 58, 57, 56, 0, 0, 70, 0, 22,
+ 0, 72, 0, 6, 20, 35, 13, 64, 69, 0,
+ 14, 74, 25, 27, 0, 69, 0, 15, 0, 65,
+ 16
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -142, -142, -142, -142, -142, 47, -142, -142, -142, -142,
- -142, -142, -142, -142, -142, -142, -5, -6, -142, -142,
- -141, 49, -1, -50, -142
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+ -166, -166, -166, -166, -12, -11, -166, -166, -166, -165,
+ 3, -69, 51, 0, -6, -166
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 1, 46, 47, 149, 48, 120, 49, 110, 122,
- 117, 118, 119, 113, 114, 50, 63, 64, 174, 51,
- 163, 166, 164, 53, 54
+ -1, 1, 53, 85, 54, 119, 55, 73, 86, 82,
+ 83, 84, 79, 80, 68, 69, 169, 56, 71, 156,
+ 160, 76, 77, 157, 58, 59
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -767,201 +752,209 @@ static const yytype_int16 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
- 52, 79, 84, 55, 80, 56, 57, 172, 56, 57,
- 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
- 101, 102, 103, 104, 105, 106, 107, 108, 58, 59,
- 128, 5, 178, 109, 60, 115, 61, 62, 182, 173,
- 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
- 108, 116, 85, 86, 87, 88, 89, 179, 158, 81,
- 180, 121, 84, 159, 151, 112, 104, 105, 106, 107,
- 108, 123, 147, 148, 84, 127, 124, 102, 103, 104,
- 105, 106, 107, 108, 152, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 84, 56, 57, 84, 126, 106, 107,
- 108, 154, 155, 157, 84, 161, 153, 84, 162, 156,
- 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 2, 170, 171, 3, 4, 5,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
- 106, 107, 108, 167, 167, 6, 7, 175, 8, 9,
- 10, 11, 176, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 3, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 177, 181,
- 183, 184, 0, 6, 168, 0, 8, 0, 82, 11,
- 0, 83, 13, 14, 15, 16, 17, 18, 19, 20,
+ 78, 57, 87, 174, 72, 88, 89, 81, 123, 15,
+ 178, 131, 17, 155, 70, 20, 132, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 167, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 120, 91, 92, 93, 94, 95, 96, 123, 124, 109,
+ 110, 111, 112, 113, 114, 115, 91, 168, 125, 61,
+ 62, 78, 134, 61, 62, 175, 78, 135, 176, 121,
+ 111, 112, 113, 114, 115, 129, 127, 137, 138, 139,
+ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 151, 152, 153, 154, 128, 60, 130, 61, 62,
+ 113, 114, 115, 117, 118, 158, 164, 165, 166, 170,
+ 78, 171, 172, 91, 173, 177, 179, 161, 161, 63,
+ 64, 162, 180, 126, 0, 65, 0, 66, 67, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 91, 3, 4, 5, 91, 0, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 0, 17,
+ 18, 19, 20, 0, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 74, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 0, 0, 15,
+ 0, 0, 17, 0, 75, 20, 0, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 74, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 0, 0, 15, 0, 0, 17, 0, 122, 20, 0,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 3, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 0, 0, 0, 0,
- 0, 6, 0, 0, 8, 0, 111, 11, 0, 83,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 74, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 0, 0, 15, 0, 0, 17, 0,
+ 159, 20, 0, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 74, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 0, 0, 15, 0,
+ 0, 17, 0, 0, 20, 0, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 0, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 15,
+ 0, 0, 17, 0, 90, 20, 0, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 0, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 15, 0, 0, 17, 0, 116, 20, 0, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 3, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 0, 0, 0, 0, 0, 6,
- 0, 0, 8, 0, 150, 11, 0, 83, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 3,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 0, 0, 0, 0, 0, 6, 0, 0,
- 8, 0, 160, 11, 0, 83, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 3, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 0, 0, 0, 0, 0, 6, 0, 0, 8, 0,
- 165, 11, 0, 83, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 3, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 0, 0,
- 0, 0, 0, 6, 0, 0, 8, 0, 169, 11,
- 0, 83, 13, 14, 15, 16, 17, 18, 19, 20,
+ 33, 34, 35, 36, 37, 38, 39, 40, 0, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 15, 0, 0, 17, 0, 163, 20, 0, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 0,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 15, 0, 0, 17, 0, 0, 20, 0,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 3, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 0, 0, 0, 0,
- 0, 6, 0, 0, 8, 0, 0, 11, 0, 83,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 0, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 90, 0, 0, 0, 0, 0,
- 0, 91, 92, 93, 94, 95, 96, 97, 98, 99,
- 100, 101, 102, 103, 104, 105, 106, 107, 108, 125,
- 0, 0, 0, 0, 0, 0, 91, 92, 93, 94,
- 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 65, 0, 0, 66, 67, 68,
- 69, 70, 71, 72, 73, 74, 75, 76, 77, 0,
- 0, 0, 0, 0, 78, 92, 93, 94, 95, 96,
- 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
- 107, 108, 93, 94, 95, 96, 97, 98, 99, 100,
- 101, 102, 103, 104, 105, 106, 107, 108, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
- 106, 107, 108
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 0, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 97, 0, 0, 0, 0, 98, 99,
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 115, 133, 0, 0, 0,
+ 0, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114, 115, 98,
+ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
+ 109, 110, 111, 112, 113, 114, 115, 0, 0, 136,
+ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
+ 109, 110, 111, 112, 113, 114, 115, 100, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ 113, 114, 115, 101, 102, 103, 104, 105, 106, 107,
+ 108, 109, 110, 111, 112, 113, 114, 115, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+ 114, 115, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 113, 114, 115, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 115
};
static const yytype_int16 yycheck[] =
{
- 1, 7, 52, 21, 9, 23, 24, 21, 23, 24,
+ 6, 1, 14, 168, 4, 16, 18, 24, 77, 19,
+ 175, 19, 22, 48, 24, 25, 24, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 19, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 19, 57, 63, 64, 65, 66, 67, 126, 24, 40,
+ 41, 42, 43, 44, 45, 46, 72, 49, 24, 21,
+ 22, 77, 24, 21, 22, 49, 82, 89, 52, 48,
+ 42, 43, 44, 45, 46, 85, 19, 98, 99, 100,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 113, 114, 115, 19, 19, 19, 21, 22,
+ 44, 45, 46, 8, 9, 19, 24, 24, 24, 24,
+ 126, 49, 24, 129, 24, 24, 19, 127, 128, 42,
+ 43, 128, 24, 82, -1, 48, -1, 50, 51, -1,
+ -1, -1, -1, -1, -1, -1, -1, 0, -1, -1,
+ -1, 157, 5, 6, 7, 161, -1, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, -1, 22,
+ 23, 24, 25, -1, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 46, 47,
- 53, 5, 173, 26, 52, 26, 54, 55, 179, 53,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 26, 58, 59, 60, 61, 62, 53, 21, 12,
- 56, 26, 112, 26, 26, 66, 46, 47, 48, 49,
- 50, 76, 7, 8, 124, 80, 77, 44, 45, 46,
- 47, 48, 49, 50, 26, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
- 106, 107, 108, 153, 23, 24, 156, 26, 48, 49,
- 50, 21, 21, 21, 164, 26, 117, 167, 52, 120,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 0, 26, 26, 3, 4, 5,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 154, 155, 21, 22, 26, 24, 25,
- 26, 27, 26, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 3, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 26, 26,
- 21, 26, -1, 21, 155, -1, 24, -1, 26, 27,
- -1, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 3, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, -1, -1, -1, -1,
- -1, 21, -1, -1, 24, -1, 26, 27, -1, 29,
+ 43, 44, 45, 46, 4, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, -1, -1, 19,
+ -1, -1, 22, -1, 24, 25, -1, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 3, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, -1, -1, -1, -1, -1, 21,
- -1, -1, 24, -1, 26, 27, -1, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 3,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, -1, -1, -1, -1, -1, 21, -1, -1,
- 24, -1, 26, 27, -1, 29, 30, 31, 32, 33,
+ 40, 41, 42, 43, 44, 45, 46, 4, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ -1, -1, 19, -1, -1, 22, -1, 24, 25, -1,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 4, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, -1, -1, 19, -1, -1, 22, -1,
+ 24, 25, -1, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 3, 52, 53,
- 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- -1, -1, -1, -1, -1, 21, -1, -1, 24, -1,
- 26, 27, -1, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 3, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, -1, -1,
- -1, -1, -1, 21, -1, -1, 24, -1, 26, 27,
- -1, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 3, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, -1, -1, -1, -1,
- -1, 21, -1, -1, 24, -1, -1, 27, -1, 29,
+ 44, 45, 46, 4, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, -1, -1, 19, -1,
+ -1, 22, -1, -1, 25, -1, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, -1, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 19,
+ -1, -1, 22, -1, 24, 25, -1, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, -1, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 26, -1, -1, -1, -1, -1,
- -1, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 26,
- -1, -1, -1, -1, -1, -1, 33, 34, 35, 36,
+ 40, 41, 42, 43, 44, 45, 46, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 19, -1, -1, 22, -1, 24, 25, -1, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, -1, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 19, -1, -1, 22, -1, 24, 25, -1, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 45, 46, -1,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 19, -1, -1, 22, -1, -1, 25, -1,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 6, -1, -1, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, -1,
- -1, -1, -1, -1, 26, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 35, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50
+ -1, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 24, -1, -1, -1, -1, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 24, -1, -1, -1,
+ -1, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 45, 46, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, -1, -1, 49,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 65, 0, 3, 4, 5, 21, 22, 24, 25,
- 26, 27, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, 66, 67, 69, 71,
- 79, 83, 86, 87, 88, 21, 23, 24, 46, 47,
- 52, 54, 55, 80, 81, 6, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 26, 81,
- 80, 69, 26, 29, 87, 81, 81, 81, 81, 81,
- 26, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 26,
- 72, 26, 86, 77, 78, 26, 26, 74, 75, 76,
- 70, 26, 73, 80, 86, 26, 26, 80, 53, 81,
- 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
- 81, 81, 81, 81, 81, 81, 81, 7, 8, 68,
- 26, 26, 26, 86, 21, 21, 86, 21, 21, 26,
- 26, 26, 52, 84, 86, 26, 85, 86, 85, 26,
- 26, 26, 21, 53, 82, 26, 26, 26, 84, 53,
- 56, 26, 84, 21, 26
+ 0, 61, 0, 5, 6, 7, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 22, 23, 24,
+ 25, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 62, 64, 66, 77, 83, 84, 85,
+ 19, 21, 22, 42, 43, 48, 50, 51, 74, 75,
+ 24, 78, 83, 67, 4, 24, 81, 82, 84, 72,
+ 73, 24, 69, 70, 71, 63, 68, 74, 75, 74,
+ 24, 84, 75, 75, 75, 75, 75, 24, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 24, 8, 9, 65,
+ 19, 48, 24, 81, 24, 24, 82, 19, 19, 83,
+ 19, 19, 24, 24, 24, 74, 49, 75, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 48, 79, 83, 19, 24,
+ 80, 83, 80, 24, 24, 24, 24, 19, 49, 76,
+ 24, 49, 24, 24, 79, 49, 52, 24, 79, 19,
+ 24
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 64, 65, 65, 66, 66, 66, 66, 67, 67,
- 67, 67, 68, 68, 68, 69, 69, 70, 69, 72,
- 71, 73, 71, 74, 71, 71, 75, 71, 76, 71,
- 71, 71, 77, 71, 78, 71, 71, 71, 71, 71,
- 79, 79, 79, 80, 80, 81, 81, 81, 81, 81,
- 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
- 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
- 82, 82, 83, 83, 84, 84, 85, 85, 86, 86,
- 87, 87, 87, 87, 87, 87, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 88
+ 0, 60, 61, 61, 62, 63, 62, 62, 62, 62,
+ 64, 64, 64, 64, 65, 65, 65, 67, 66, 68,
+ 66, 69, 66, 66, 70, 66, 71, 66, 66, 66,
+ 72, 66, 73, 66, 66, 66, 66, 74, 74, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 76, 76, 77, 77, 78, 79,
+ 79, 80, 80, 81, 81, 81, 82, 82, 83, 83,
+ 84, 84, 84, 84, 84, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 0, 2, 1, 2, 1, 1, 3, 3,
- 3, 4, 3, 5, 6, 1, 1, 0, 5, 0,
- 4, 0, 5, 0, 5, 3, 0, 6, 0, 6,
- 4, 3, 0, 4, 0, 4, 4, 5, 2, 3,
- 3, 3, 4, 1, 1, 1, 1, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 2, 2, 3,
- 1, 3, 1, 2, 0, 1, 0, 1, 1, 2,
+ 0, 2, 0, 2, 1, 0, 4, 1, 1, 2,
+ 3, 3, 3, 4, 3, 5, 6, 0, 3, 0,
+ 4, 0, 4, 2, 0, 5, 0, 5, 3, 2,
+ 0, 3, 0, 3, 3, 4, 2, 1, 1, 1,
+ 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
+ 2, 2, 2, 3, 1, 3, 1, 2, 2, 0,
+ 1, 0, 1, 2, 4, 1, 1, 2, 1, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1
+ 1, 1, 1, 1, 1, 1
};
@@ -1555,7 +1548,7 @@ YYLTYPE yylloc = yyloc_default;
yychar = YYEMPTY; /* Cause a token to be read. */
/* User initialization code. */
-#line 165 "glcpp/glcpp-parse.y" /* yacc.c:1429 */
+#line 155 "glcpp/glcpp-parse.y" /* yacc.c:1429 */
{
yylloc.first_line = 1;
yylloc.first_column = 1;
@@ -1564,7 +1557,7 @@ YYLTYPE yylloc = yyloc_default;
yylloc.source = 0;
}
-#line 1568 "glcpp/glcpp-parse.c" /* yacc.c:1429 */
+#line 1561 "glcpp/glcpp-parse.c" /* yacc.c:1429 */
yylsp[0] = yylloc;
goto yysetstate;
@@ -1750,38 +1743,64 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 6:
-#line 213 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 4:
+#line 194 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ {
+ ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n");
+ }
+#line 1752 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+ break;
+
+ case 5:
+#line 197 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ {
+ glcpp_parser_resolve_implicit_version(parser);
+ }
+#line 1760 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+ break;
+
+ case 6:
+#line 199 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ {
+
+ if (parser->skip_stack == NULL ||
+ parser->skip_stack->type == SKIP_NO_SKIP)
+ {
+ _glcpp_parser_expand_and_lex_from (parser,
+ LINE_EXPANDED, (yyvsp[-1].token_list));
+ }
+ }
+#line 1774 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+ break;
+
+ case 7:
+#line 208 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
_glcpp_parser_print_expanded_token_list (parser, (yyvsp[0].token_list));
ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n");
ralloc_free ((yyvsp[0].token_list));
}
-#line 1761 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1784 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 8:
-#line 222 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 10:
+#line 218 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- if (parser->is_gles && (yyvsp[-1].expression_value).undefined_macro)
- glcpp_error(& (yylsp[-2]), parser, "undefined macro %s in expression (illegal in GLES)", (yyvsp[-1].expression_value).undefined_macro);
- _glcpp_parser_skip_stack_push_if (parser, & (yylsp[-2]), (yyvsp[-1].expression_value).value);
+ _glcpp_parser_skip_stack_push_if (parser, & (yylsp[-2]), (yyvsp[-1].ival));
}
-#line 1771 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1792 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 9:
-#line 227 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 11:
+#line 221 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- if (parser->is_gles && (yyvsp[-1].expression_value).undefined_macro)
- glcpp_error(& (yylsp[-2]), parser, "undefined macro %s in expression (illegal in GLES)", (yyvsp[-1].expression_value).undefined_macro);
- _glcpp_parser_skip_stack_change_if (parser, & (yylsp[-2]), "elif", (yyvsp[-1].expression_value).value);
+ _glcpp_parser_skip_stack_change_if (parser, & (yylsp[-2]), "elif", (yyvsp[-1].ival));
}
-#line 1781 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1800 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 10:
-#line 232 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 12:
+#line 224 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
parser->has_new_line_number = 1;
parser->new_line_number = (yyvsp[-1].ival);
@@ -1790,11 +1809,11 @@ yyreduce:
"#line %" PRIiMAX "\n",
(yyvsp[-1].ival));
}
-#line 1794 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1813 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 11:
-#line 240 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 13:
+#line 232 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
parser->has_new_line_number = 1;
parser->new_line_number = (yyvsp[-2].ival);
@@ -1805,110 +1824,72 @@ yyreduce:
"#line %" PRIiMAX " %" PRIiMAX "\n",
(yyvsp[-2].ival), (yyvsp[-1].ival));
}
-#line 1809 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1828 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 12:
-#line 253 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 14:
+#line 245 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
_define_object_macro (parser, & (yylsp[-2]), (yyvsp[-2].str), (yyvsp[-1].token_list));
}
-#line 1817 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1836 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 13:
-#line 256 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 15:
+#line 248 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
_define_function_macro (parser, & (yylsp[-4]), (yyvsp[-4].str), NULL, (yyvsp[-1].token_list));
}
-#line 1825 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1844 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 14:
-#line 259 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 16:
+#line 251 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
_define_function_macro (parser, & (yylsp[-5]), (yyvsp[-5].str), (yyvsp[-3].string_list), (yyvsp[-1].token_list));
}
-#line 1833 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
- break;
-
- case 15:
-#line 265 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- {
- ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n");
- }
-#line 1841 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1852 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 17:
-#line 269 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 257 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
glcpp_parser_resolve_implicit_version(parser);
}
-#line 1849 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
- break;
-
- case 18:
-#line 271 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- {
-
- if (parser->skip_stack == NULL ||
- parser->skip_stack->type == SKIP_NO_SKIP)
- {
- _glcpp_parser_expand_and_lex_from (parser,
- LINE_EXPANDED, (yyvsp[-1].token_list),
- EXPANSION_MODE_IGNORE_DEFINED);
- }
- }
-#line 1864 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1860 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 19:
-#line 284 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 260 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
glcpp_parser_resolve_implicit_version(parser);
}
-#line 1872 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1868 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 21:
-#line 287 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 20:
+#line 262 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- glcpp_parser_resolve_implicit_version(parser);
- }
-#line 1880 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
- break;
-
- case 22:
-#line 289 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- {
- macro_t *macro;
- if (strcmp("__LINE__", (yyvsp[-1].str)) == 0
- || strcmp("__FILE__", (yyvsp[-1].str)) == 0
- || strcmp("__VERSION__", (yyvsp[-1].str)) == 0)
- glcpp_error(& (yylsp[-4]), parser, "Built-in (pre-defined)"
- " macro names can not be undefined.");
-
- macro = hash_table_find (parser->defines, (yyvsp[-1].str));
+ macro_t *macro = hash_table_find (parser->defines, (yyvsp[-1].str));
if (macro) {
hash_table_remove (parser->defines, (yyvsp[-1].str));
ralloc_free (macro);
}
ralloc_free ((yyvsp[-1].str));
}
-#line 1900 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1881 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 23:
-#line 304 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 21:
+#line 270 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
glcpp_parser_resolve_implicit_version(parser);
}
-#line 1908 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1889 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 24:
-#line 306 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 22:
+#line 272 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
/* Be careful to only evaluate the 'if' expression if
* we are not skipping. When we are skipping, we
@@ -1921,71 +1902,70 @@ yyreduce:
parser->skip_stack->type == SKIP_NO_SKIP)
{
_glcpp_parser_expand_and_lex_from (parser,
- IF_EXPANDED, (yyvsp[-1].token_list),
- EXPANSION_MODE_EVALUATE_DEFINED);
+ IF_EXPANDED, (yyvsp[-1].token_list));
}
else
{
- _glcpp_parser_skip_stack_push_if (parser, & (yylsp[-4]), 0);
+ _glcpp_parser_skip_stack_push_if (parser, & (yylsp[-3]), 0);
parser->skip_stack->type = SKIP_TO_ENDIF;
}
}
-#line 1934 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1914 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 25:
-#line 327 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 23:
+#line 292 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
/* #if without an expression is only an error if we
* are not skipping */
if (parser->skip_stack == NULL ||
parser->skip_stack->type == SKIP_NO_SKIP)
{
- glcpp_error(& (yylsp[-2]), parser, "#if with no expression");
+ glcpp_error(& (yylsp[-1]), parser, "#if with no expression");
}
- _glcpp_parser_skip_stack_push_if (parser, & (yylsp[-2]), 0);
+ _glcpp_parser_skip_stack_push_if (parser, & (yylsp[-1]), 0);
}
-#line 1949 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1929 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 26:
-#line 337 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 24:
+#line 302 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
glcpp_parser_resolve_implicit_version(parser);
}
-#line 1957 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1937 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 27:
-#line 339 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 25:
+#line 304 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[-2].str));
ralloc_free ((yyvsp[-2].str));
- _glcpp_parser_skip_stack_push_if (parser, & (yylsp[-5]), macro != NULL);
+ _glcpp_parser_skip_stack_push_if (parser, & (yylsp[-4]), macro != NULL);
}
-#line 1967 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1947 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 28:
-#line 344 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 26:
+#line 309 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
glcpp_parser_resolve_implicit_version(parser);
}
-#line 1975 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1955 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 29:
-#line 346 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 27:
+#line 311 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[-2].str));
ralloc_free ((yyvsp[-2].str));
_glcpp_parser_skip_stack_push_if (parser, & (yylsp[-3]), macro == NULL);
}
-#line 1985 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1965 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 30:
-#line 351 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 28:
+#line 316 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
/* Be careful to only evaluate the 'elif' expression
* if we are not skipping. When we are skipping, we
@@ -1998,776 +1978,665 @@ yyreduce:
parser->skip_stack->type == SKIP_TO_ELSE)
{
_glcpp_parser_expand_and_lex_from (parser,
- ELIF_EXPANDED, (yyvsp[-1].token_list),
- EXPANSION_MODE_EVALUATE_DEFINED);
+ ELIF_EXPANDED, (yyvsp[-1].token_list));
}
else if (parser->skip_stack &&
parser->skip_stack->has_else)
{
- glcpp_error(& (yylsp[-3]), parser, "#elif after #else");
+ glcpp_error(& (yylsp[-2]), parser, "#elif after #else");
}
else
{
- _glcpp_parser_skip_stack_change_if (parser, & (yylsp[-3]),
+ _glcpp_parser_skip_stack_change_if (parser, & (yylsp[-2]),
"elif", 0);
}
}
-#line 2016 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 1995 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 31:
-#line 377 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 29:
+#line 341 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
/* #elif without an expression is an error unless we
* are skipping. */
if (parser->skip_stack &&
parser->skip_stack->type == SKIP_TO_ELSE)
{
- glcpp_error(& (yylsp[-2]), parser, "#elif with no expression");
+ glcpp_error(& (yylsp[-1]), parser, "#elif with no expression");
}
else if (parser->skip_stack &&
parser->skip_stack->has_else)
{
- glcpp_error(& (yylsp[-2]), parser, "#elif after #else");
+ glcpp_error(& (yylsp[-1]), parser, "#elif after #else");
}
else
{
- _glcpp_parser_skip_stack_change_if (parser, & (yylsp[-2]),
+ _glcpp_parser_skip_stack_change_if (parser, & (yylsp[-1]),
"elif", 0);
- glcpp_warning(& (yylsp[-2]), parser, "ignoring illegal #elif without expression");
+ glcpp_warning(& (yylsp[-1]), parser, "ignoring illegal #elif without expression");
}
}
-#line 2041 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2020 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 32:
-#line 397 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- { parser->lexing_directive = 1; }
-#line 2047 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
- break;
-
- case 33:
-#line 397 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 30:
+#line 361 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
if (parser->skip_stack &&
parser->skip_stack->has_else)
{
- glcpp_error(& (yylsp[-3]), parser, "multiple #else");
+ glcpp_error(& (yylsp[0]), parser, "multiple #else");
}
else
{
- _glcpp_parser_skip_stack_change_if (parser, & (yylsp[-3]), "else", 1);
+ _glcpp_parser_skip_stack_change_if (parser, & (yylsp[0]), "else", 1);
if (parser->skip_stack)
parser->skip_stack->has_else = true;
}
}
-#line 2065 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2038 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 34:
-#line 410 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 32:
+#line 374 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- _glcpp_parser_skip_stack_pop (parser, & (yylsp[-1]));
+ _glcpp_parser_skip_stack_pop (parser, & (yylsp[0]));
}
-#line 2073 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2046 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 36:
-#line 413 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 34:
+#line 377 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
if (parser->version_resolved) {
- glcpp_error(& (yylsp[-3]), parser, "#version must appear on the first line");
+ glcpp_error(& (yylsp[-2]), parser, "#version must appear on the first line");
}
_glcpp_parser_handle_version_declaration(parser, (yyvsp[-1].ival), NULL, true);
}
-#line 2084 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2057 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 37:
-#line 419 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 35:
+#line 383 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
if (parser->version_resolved) {
- glcpp_error(& (yylsp[-4]), parser, "#version must appear on the first line");
+ glcpp_error(& (yylsp[-3]), parser, "#version must appear on the first line");
}
_glcpp_parser_handle_version_declaration(parser, (yyvsp[-2].ival), (yyvsp[-1].str), true);
}
-#line 2095 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2068 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 38:
-#line 425 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 36:
+#line 389 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
glcpp_parser_resolve_implicit_version(parser);
}
-#line 2103 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2076 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 39:
-#line 428 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 37:
+#line 395 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "#%s", (yyvsp[-1].str));
+ if (strlen ((yyvsp[0].str)) >= 3 && strncmp ((yyvsp[0].str), "0x", 2) == 0) {
+ (yyval.ival) = strtoll ((yyvsp[0].str) + 2, NULL, 16);
+ } else if ((yyvsp[0].str)[0] == '0') {
+ (yyval.ival) = strtoll ((yyvsp[0].str), NULL, 8);
+ } else {
+ (yyval.ival) = strtoll ((yyvsp[0].str), NULL, 10);
+ }
}
-#line 2111 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2090 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+ break;
+
+ case 38:
+#line 404 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ {
+ (yyval.ival) = (yyvsp[0].ival);
+ }
+#line 2098 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 40:
-#line 434 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 410 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- glcpp_error(& (yylsp[-2]), parser, "#%s", (yyvsp[-1].str));
+ if (parser->is_gles)
+ glcpp_error(& (yylsp[0]), parser, "undefined macro %s in expression (illegal in GLES)", (yyvsp[0].str));
+ (yyval.ival) = 0;
}
-#line 2119 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2108 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 41:
-#line 437 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 415 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- glcpp_error (& (yylsp[-2]), parser, "#define without macro name");
+ (yyval.ival) = (yyvsp[-2].ival) || (yyvsp[0].ival);
}
-#line 2127 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2116 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 42:
-#line 440 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 418 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- glcpp_error (& (yylsp[-3]), parser, "Illegal non-directive after #");
+ (yyval.ival) = (yyvsp[-2].ival) && (yyvsp[0].ival);
}
-#line 2135 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2124 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 43:
-#line 446 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 421 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- if (strlen ((yyvsp[0].str)) >= 3 && strncmp ((yyvsp[0].str), "0x", 2) == 0) {
- (yyval.ival) = strtoll ((yyvsp[0].str) + 2, NULL, 16);
- } else if ((yyvsp[0].str)[0] == '0') {
- (yyval.ival) = strtoll ((yyvsp[0].str), NULL, 8);
- } else {
- (yyval.ival) = strtoll ((yyvsp[0].str), NULL, 10);
- }
+ (yyval.ival) = (yyvsp[-2].ival) | (yyvsp[0].ival);
}
-#line 2149 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2132 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 44:
-#line 455 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 424 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.ival) = (yyvsp[0].ival);
+ (yyval.ival) = (yyvsp[-2].ival) ^ (yyvsp[0].ival);
}
-#line 2157 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2140 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 45:
-#line 460 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 427 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[0].ival);
- (yyval.expression_value).undefined_macro = NULL;
+ (yyval.ival) = (yyvsp[-2].ival) & (yyvsp[0].ival);
}
-#line 2166 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2148 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 46:
-#line 464 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 430 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = 0;
- if (parser->is_gles)
- (yyval.expression_value).undefined_macro = ralloc_strdup (parser, (yyvsp[0].str));
- else
- (yyval.expression_value).undefined_macro = NULL;
+ (yyval.ival) = (yyvsp[-2].ival) != (yyvsp[0].ival);
}
-#line 2178 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2156 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 47:
-#line 471 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 433 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value || (yyvsp[0].expression_value).value;
-
- /* Short-circuit: Only flag undefined from right side
- * if left side evaluates to false.
- */
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else if (! (yyvsp[-2].expression_value).value)
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) == (yyvsp[0].ival);
}
-#line 2194 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2164 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 48:
-#line 482 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 436 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value && (yyvsp[0].expression_value).value;
-
- /* Short-circuit: Only flag undefined from right-side
- * if left side evaluates to true.
- */
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else if ((yyvsp[-2].expression_value).value)
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) >= (yyvsp[0].ival);
}
-#line 2210 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2172 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 49:
-#line 493 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 439 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value | (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) <= (yyvsp[0].ival);
}
-#line 2222 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2180 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 50:
-#line 500 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 442 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value ^ (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) > (yyvsp[0].ival);
}
-#line 2234 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2188 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 51:
-#line 507 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 445 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value & (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) < (yyvsp[0].ival);
}
-#line 2246 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2196 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 52:
-#line 514 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 448 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value != (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) >> (yyvsp[0].ival);
}
-#line 2258 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2204 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 53:
-#line 521 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 451 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value == (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) << (yyvsp[0].ival);
}
-#line 2270 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2212 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 54:
-#line 528 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 454 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value >= (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) - (yyvsp[0].ival);
}
-#line 2282 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2220 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 55:
-#line 535 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 457 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value <= (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) + (yyvsp[0].ival);
}
-#line 2294 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2228 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 56:
-#line 542 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 460 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value > (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ if ((yyvsp[0].ival) == 0) {
+ yyerror (& (yylsp[-2]), parser,
+ "zero modulus in preprocessor directive");
+ } else {
+ (yyval.ival) = (yyvsp[-2].ival) % (yyvsp[0].ival);
+ }
}
-#line 2306 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2241 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 57:
-#line 549 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 468 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value < (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ if ((yyvsp[0].ival) == 0) {
+ yyerror (& (yylsp[-2]), parser,
+ "division by 0 in preprocessor directive");
+ } else {
+ (yyval.ival) = (yyvsp[-2].ival) / (yyvsp[0].ival);
+ }
}
-#line 2318 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2254 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 58:
-#line 556 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 476 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value >> (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-2].ival) * (yyvsp[0].ival);
}
-#line 2330 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2262 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 59:
-#line 563 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 479 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value << (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = ! (yyvsp[0].ival);
}
-#line 2342 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2270 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 60:
-#line 570 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 482 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value - (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = ~ (yyvsp[0].ival);
}
-#line 2354 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2278 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 61:
-#line 577 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 485 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value + (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = - (yyvsp[0].ival);
}
-#line 2366 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2286 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 62:
-#line 584 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 488 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- if ((yyvsp[0].expression_value).value == 0) {
- yyerror (& (yylsp[-2]), parser,
- "zero modulus in preprocessor directive");
- } else {
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value % (yyvsp[0].expression_value).value;
- }
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = + (yyvsp[0].ival);
}
-#line 2383 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2294 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 63:
-#line 596 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 491 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- if ((yyvsp[0].expression_value).value == 0) {
- yyerror (& (yylsp[-2]), parser,
- "division by 0 in preprocessor directive");
- } else {
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value / (yyvsp[0].expression_value).value;
- }
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.ival) = (yyvsp[-1].ival);
}
-#line 2400 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2302 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 64:
-#line 608 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 497 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = (yyvsp[-2].expression_value).value * (yyvsp[0].expression_value).value;
- if ((yyvsp[-2].expression_value).undefined_macro)
- (yyval.expression_value).undefined_macro = (yyvsp[-2].expression_value).undefined_macro;
- else
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.string_list) = _string_list_create (parser);
+ _string_list_append_item ((yyval.string_list), (yyvsp[0].str));
+ ralloc_steal ((yyval.string_list), (yyvsp[0].str));
}
-#line 2412 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2312 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 65:
-#line 615 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 502 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = ! (yyvsp[0].expression_value).value;
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ (yyval.string_list) = (yyvsp[-2].string_list);
+ _string_list_append_item ((yyval.string_list), (yyvsp[0].str));
+ ralloc_steal ((yyval.string_list), (yyvsp[0].str));
}
-#line 2421 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2322 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 66:
-#line 619 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- {
- (yyval.expression_value).value = ~ (yyvsp[0].expression_value).value;
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
- }
-#line 2430 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
- break;
-
- case 67:
-#line 623 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- {
- (yyval.expression_value).value = - (yyvsp[0].expression_value).value;
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
- }
-#line 2439 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 510 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ { (yyval.token_list) = NULL; }
+#line 2328 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 68:
-#line 627 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 515 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.expression_value).value = + (yyvsp[0].expression_value).value;
- (yyval.expression_value).undefined_macro = (yyvsp[0].expression_value).undefined_macro;
+ yyerror (& (yylsp[-1]), parser, "Invalid tokens after #");
}
-#line 2448 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2336 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 69:
-#line 631 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- {
- (yyval.expression_value) = (yyvsp[-1].expression_value);
- }
-#line 2456 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 521 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ { (yyval.token_list) = NULL; }
+#line 2342 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 70:
-#line 637 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 72:
+#line 527 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.string_list) = _string_list_create (parser);
- _string_list_append_item ((yyval.string_list), (yyvsp[0].str));
- ralloc_steal ((yyval.string_list), (yyvsp[0].str));
+ glcpp_warning(&(yylsp[0]), parser, "extra tokens at end of directive");
}
-#line 2466 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2350 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 71:
-#line 642 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 73:
+#line 534 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- (yyval.string_list) = (yyvsp[-2].string_list);
- _string_list_append_item ((yyval.string_list), (yyvsp[0].str));
- ralloc_steal ((yyval.string_list), (yyvsp[0].str));
+ int v = hash_table_find (parser->defines, (yyvsp[0].str)) ? 1 : 0;
+ (yyval.token) = _token_create_ival (parser, INTEGER, v);
}
-#line 2476 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2359 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 72:
-#line 650 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- { (yyval.token_list) = NULL; }
-#line 2482 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+ case 74:
+#line 538 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ {
+ int v = hash_table_find (parser->defines, (yyvsp[-1].str)) ? 1 : 0;
+ (yyval.token) = _token_create_ival (parser, INTEGER, v);
+ }
+#line 2368 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 74:
-#line 655 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- { (yyval.token_list) = NULL; }
-#line 2488 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+ case 76:
+#line 547 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ {
+ (yyval.token_list) = _token_list_create (parser);
+ _token_list_append ((yyval.token_list), (yyvsp[0].token));
+ }
+#line 2377 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 77:
-#line 661 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 551 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
- glcpp_error(&(yylsp[0]), parser, "extra tokens at end of directive");
+ (yyval.token_list) = (yyvsp[-1].token_list);
+ _token_list_append ((yyval.token_list), (yyvsp[0].token));
}
-#line 2496 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2386 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 78:
-#line 667 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 558 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
parser->space_tokens = 1;
(yyval.token_list) = _token_list_create (parser);
_token_list_append ((yyval.token_list), (yyvsp[0].token));
}
-#line 2506 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2396 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 79:
-#line 672 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 563 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
(yyval.token_list) = (yyvsp[-1].token_list);
_token_list_append ((yyval.token_list), (yyvsp[0].token));
}
-#line 2515 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2405 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 80:
-#line 679 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 570 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
(yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[0].str));
(yyval.token)->location = yylloc;
}
-#line 2524 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2414 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 81:
-#line 683 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 574 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
(yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[0].str));
(yyval.token)->location = yylloc;
}
-#line 2533 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2423 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 82:
-#line 687 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 578 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
(yyval.token) = _token_create_ival (parser, (yyvsp[0].ival), (yyvsp[0].ival));
(yyval.token)->location = yylloc;
}
-#line 2542 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2432 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
case 83:
-#line 691 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- {
- (yyval.token) = _token_create_ival (parser, DEFINED, DEFINED);
- (yyval.token)->location = yylloc;
- }
-#line 2551 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
- break;
-
- case 84:
-#line 695 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+#line 582 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
(yyval.token) = _token_create_str (parser, OTHER, (yyvsp[0].str));
(yyval.token)->location = yylloc;
}
-#line 2560 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2441 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 85:
-#line 699 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 84:
+#line 586 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{
(yyval.token) = _token_create_ival (parser, SPACE, SPACE);
(yyval.token)->location = yylloc;
}
-#line 2569 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2450 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 86:
-#line 706 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 85:
+#line 593 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '['; }
-#line 2575 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2456 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 87:
-#line 707 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 86:
+#line 594 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = ']'; }
-#line 2581 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2462 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 88:
-#line 708 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 87:
+#line 595 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '('; }
-#line 2587 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2468 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 89:
-#line 709 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 88:
+#line 596 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = ')'; }
-#line 2593 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2474 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 90:
-#line 710 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 89:
+#line 597 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '{'; }
-#line 2599 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2480 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 91:
-#line 711 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 90:
+#line 598 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '}'; }
-#line 2605 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2486 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 92:
-#line 712 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 91:
+#line 599 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '.'; }
-#line 2611 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2492 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 93:
-#line 713 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 92:
+#line 600 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '&'; }
-#line 2617 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2498 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 94:
-#line 714 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 93:
+#line 601 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '*'; }
-#line 2623 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2504 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 95:
-#line 715 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 94:
+#line 602 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '+'; }
-#line 2629 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2510 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 96:
-#line 716 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 95:
+#line 603 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '-'; }
-#line 2635 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2516 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 97:
-#line 717 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 96:
+#line 604 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '~'; }
-#line 2641 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2522 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 98:
-#line 718 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 97:
+#line 605 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '!'; }
-#line 2647 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2528 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 99:
-#line 719 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 98:
+#line 606 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '/'; }
-#line 2653 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2534 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 100:
-#line 720 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 99:
+#line 607 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '%'; }
-#line 2659 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2540 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 101:
-#line 721 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 100:
+#line 608 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = LEFT_SHIFT; }
-#line 2665 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2546 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 102:
-#line 722 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 101:
+#line 609 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = RIGHT_SHIFT; }
-#line 2671 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2552 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 103:
-#line 723 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 102:
+#line 610 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '<'; }
-#line 2677 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2558 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 104:
-#line 724 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 103:
+#line 611 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '>'; }
-#line 2683 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2564 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 105:
-#line 725 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 104:
+#line 612 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = LESS_OR_EQUAL; }
-#line 2689 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2570 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 106:
-#line 726 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 105:
+#line 613 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = GREATER_OR_EQUAL; }
-#line 2695 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2576 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 107:
-#line 727 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 106:
+#line 614 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = EQUAL; }
-#line 2701 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2582 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 108:
-#line 728 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 107:
+#line 615 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = NOT_EQUAL; }
-#line 2707 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2588 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 109:
-#line 729 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 108:
+#line 616 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '^'; }
-#line 2713 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2594 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 110:
-#line 730 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 109:
+#line 617 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '|'; }
-#line 2719 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2600 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 111:
-#line 731 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 110:
+#line 618 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = AND; }
-#line 2725 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2606 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 112:
-#line 732 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 111:
+#line 619 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = OR; }
-#line 2731 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2612 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 113:
-#line 733 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 112:
+#line 620 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = ';'; }
-#line 2737 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2618 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 114:
-#line 734 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 113:
+#line 621 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = ','; }
-#line 2743 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2624 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 115:
-#line 735 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 114:
+#line 622 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = '='; }
-#line 2749 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2630 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
- case 116:
-#line 736 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
+ case 115:
+#line 623 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
{ (yyval.ival) = PASTE; }
-#line 2755 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
- break;
-
- case 117:
-#line 737 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- { (yyval.ival) = PLUS_PLUS; }
-#line 2761 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
- break;
-
- case 118:
-#line 738 "glcpp/glcpp-parse.y" /* yacc.c:1646 */
- { (yyval.ival) = MINUS_MINUS; }
-#line 2767 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2636 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
break;
-#line 2771 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
+#line 2640 "glcpp/glcpp-parse.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -3002,7 +2871,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 741 "glcpp/glcpp-parse.y" /* yacc.c:1906 */
+#line 626 "glcpp/glcpp-parse.y" /* yacc.c:1906 */
string_list_t *
@@ -3056,25 +2925,6 @@ _string_list_contains (string_list_t *list, const char *member, int *index)
return 0;
}
-/* Return duplicate string in list (if any), NULL otherwise. */
-const char *
-_string_list_has_duplicate (string_list_t *list)
-{
- string_node_t *node, *dup;
-
- if (list == NULL)
- return NULL;
-
- for (node = list->head; node; node = node->next) {
- for (dup = node->next; dup; dup = dup->next) {
- if (strcmp (node->str, dup->str) == 0)
- return node->str;
- }
- }
-
- return NULL;
-}
-
int
_string_list_length (string_list_t *list)
{
@@ -3332,16 +3182,14 @@ _token_list_equal_ignoring_space (token_list_t *a, token_list_t *b)
if (node_a == NULL || node_b == NULL)
return 0;
- /* Make sure whitespace appears in the same places in both.
- * It need not be exactly the same amount of whitespace,
- * though.
- */
- if (node_a->token->type == SPACE
- && node_b->token->type == SPACE) {
- while (node_a->token->type == SPACE)
- node_a = node_a->next;
- while (node_b->token->type == SPACE)
- node_b = node_b->next;
+
+ if (node_a->token->type == SPACE) {
+ node_a = node_a->next;
+ continue;
+ }
+
+ if (node_b->token->type == SPACE) {
+ node_b = node_b->next;
continue;
}
@@ -3421,21 +3269,14 @@ _token_print (char **out, size_t *len, token_t *token)
case PASTE:
ralloc_asprintf_rewrite_tail (out, len, "##");
break;
- case PLUS_PLUS:
- ralloc_asprintf_rewrite_tail (out, len, "++");
- break;
- case MINUS_MINUS:
- ralloc_asprintf_rewrite_tail (out, len, "--");
- break;
- case DEFINED:
- ralloc_asprintf_rewrite_tail (out, len, "defined");
+ case COMMA_FINAL:
+ ralloc_asprintf_rewrite_tail (out, len, ",");
break;
case PLACEHOLDER:
/* Nothing to print. */
break;
default:
assert(!"Error: Don't know how to print token.");
-
break;
}
}
@@ -3611,18 +3452,14 @@ glcpp_parser_create (const struct gl_extensions *extensions, gl_api api)
parser->defines = hash_table_ctor (32, hash_table_string_hash,
hash_table_string_compare);
parser->active = NULL;
- parser->lexing_directive = 0;
+ parser->lexing_if = 0;
parser->space_tokens = 1;
- parser->last_token_was_newline = 0;
- parser->last_token_was_space = 0;
- parser->first_non_space_token_this_line = 1;
parser->newline_as_space = 0;
parser->in_control_line = 0;
parser->paren_count = 0;
parser->commented_newlines = 0;
parser->skip_stack = NULL;
- parser->skipping = 0;
parser->lex_from_list = NULL;
parser->lex_from_node = NULL;
@@ -3768,143 +3605,15 @@ _token_list_create_with_one_integer (void *ctx, int ival)
return _token_list_create_with_one_ival (ctx, INTEGER, ival);
}
-/* Evaluate a DEFINED token node (based on subsequent tokens in the list).
- *
- * Note: This function must only be called when "node" is a DEFINED token,
- * (and will abort with an assertion failure otherwise).
- *
- * If "node" is followed, (ignoring any SPACE tokens), by an IDENTIFIER token
- * (optionally preceded and followed by '(' and ')' tokens) then the following
- * occurs:
- *
- * If the identifier is a defined macro, this function returns 1.
- *
- * If the identifier is not a defined macro, this function returns 0.
- *
- * In either case, *last will be updated to the last node in the list
- * consumed by the evaluation, (either the token of the identifier or the
- * token of the closing parenthesis).
- *
- * In all other cases, (such as "node is the final node of the list", or
- * "missing closing parenthesis", etc.), this function generates a
- * preprocessor error, returns -1 and *last will not be set.
- */
-static int
-_glcpp_parser_evaluate_defined (glcpp_parser_t *parser,
- token_node_t *node,
- token_node_t **last)
-{
- token_node_t *argument, *defined = node;
-
- assert (node->token->type == DEFINED);
-
- node = node->next;
-
- /* Ignore whitespace after DEFINED token. */
- while (node && node->token->type == SPACE)
- node = node->next;
-
- if (node == NULL)
- goto FAIL;
-
- if (node->token->type == IDENTIFIER || node->token->type == OTHER) {
- argument = node;
- } else if (node->token->type == '(') {
- node = node->next;
-
- /* Ignore whitespace after '(' token. */
- while (node && node->token->type == SPACE)
- node = node->next;
-
- if (node == NULL || (node->token->type != IDENTIFIER &&
- node->token->type != OTHER))
- {
- goto FAIL;
- }
-
- argument = node;
-
- node = node->next;
-
- /* Ignore whitespace after identifier, before ')' token. */
- while (node && node->token->type == SPACE)
- node = node->next;
-
- if (node == NULL || node->token->type != ')')
- goto FAIL;
- } else {
- goto FAIL;
- }
-
- *last = node;
-
- return hash_table_find (parser->defines,
- argument->token->value.str) ? 1 : 0;
-
-FAIL:
- glcpp_error (&defined->token->location, parser,
- "\"defined\" not followed by an identifier");
- return -1;
-}
-
-/* Evaluate all DEFINED nodes in a given list, modifying the list in place.
- */
-static void
-_glcpp_parser_evaluate_defined_in_list (glcpp_parser_t *parser,
- token_list_t *list)
-{
- token_node_t *node, *node_prev, *replacement, *last = NULL;
- int value;
-
- if (list == NULL)
- return;
-
- node_prev = NULL;
- node = list->head;
-
- while (node) {
-
- if (node->token->type != DEFINED)
- goto NEXT;
-
- value = _glcpp_parser_evaluate_defined (parser, node, &last);
- if (value == -1)
- goto NEXT;
-
- replacement = ralloc (list, token_node_t);
- replacement->token = _token_create_ival (list, INTEGER, value);
-
- /* Splice replacement node into list, replacing from "node"
- * through "last". */
- if (node_prev)
- node_prev->next = replacement;
- else
- list->head = replacement;
- replacement->next = last->next;
- if (last == list->tail)
- list->tail = replacement;
-
- node = replacement;
-
- NEXT:
- node_prev = node;
- node = node->next;
- }
-}
-
/* Perform macro expansion on 'list', placing the resulting tokens
* into a new list which is initialized with a first token of type
* 'head_token_type'. Then begin lexing from the resulting list,
* (return to the current lexing source when this list is exhausted).
- *
- * See the documentation of _glcpp_parser_expand_token_list for a description
- * of the "mode" parameter.
*/
static void
_glcpp_parser_expand_and_lex_from (glcpp_parser_t *parser,
int head_token_type,
- token_list_t *list,
- expansion_mode_t mode)
+ token_list_t *list)
{
token_list_t *expanded;
token_t *token;
@@ -3912,7 +3621,7 @@ _glcpp_parser_expand_and_lex_from (glcpp_parser_t *parser,
expanded = _token_list_create (parser);
token = _token_create_ival (parser, head_token_type, head_token_type);
_token_list_append (expanded, token);
- _glcpp_parser_expand_token_list (parser, list, mode);
+ _glcpp_parser_expand_token_list (parser, list);
_token_list_append_list (expanded, list);
glcpp_parser_lex_from (parser, expanded);
}
@@ -3975,15 +3684,12 @@ _glcpp_parser_apply_pastes (glcpp_parser_t *parser, token_list_t *list)
* *last to the last node in the list that was consumed by the
* expansion. Specifically, *last will be set as follows: as the
* token of the closing right parenthesis.
- *
- * See the documentation of _glcpp_parser_expand_token_list for a description
- * of the "mode" parameter.
*/
static token_list_t *
_glcpp_parser_expand_function (glcpp_parser_t *parser,
token_node_t *node,
- token_node_t **last,
- expansion_mode_t mode)
+ token_node_t **last)
+
{
macro_t *macro;
const char *identifier;
@@ -4052,8 +3758,7 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser,
expanded_argument = _token_list_copy (parser,
argument);
_glcpp_parser_expand_token_list (parser,
- expanded_argument,
- mode);
+ expanded_argument);
_token_list_append_list (substituted,
expanded_argument);
} else {
@@ -4093,15 +3798,11 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser,
*
* As the token of the closing right parenthesis in the case of
* function-like macro expansion.
- *
- * See the documentation of _glcpp_parser_expand_token_list for a description
- * of the "mode" parameter.
*/
static token_list_t *
_glcpp_parser_expand_node (glcpp_parser_t *parser,
token_node_t *node,
- token_node_t **last,
- expansion_mode_t mode)
+ token_node_t **last)
{
token_t *token = node->token;
const char *identifier;
@@ -4109,6 +3810,14 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser,
/* We only expand identifiers */
if (token->type != IDENTIFIER) {
+ /* We change any COMMA into a COMMA_FINAL to prevent
+ * it being mistaken for an argument separator
+ * later. */
+ if (token->type == ',') {
+ token->type = COMMA_FINAL;
+ token->value.ival = COMMA_FINAL;
+ }
+
return NULL;
}
@@ -4160,7 +3869,7 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser,
return replacement;
}
- return _glcpp_parser_expand_function (parser, node, last, mode);
+ return _glcpp_parser_expand_function (parser, node, last);
}
/* Push a new identifier onto the parser's active list.
@@ -4219,28 +3928,11 @@ _parser_active_list_contains (glcpp_parser_t *parser, const char *identifier)
/* Walk over the token list replacing nodes with their expansion.
* Whenever nodes are expanded the walking will walk over the new
* nodes, continuing to expand as necessary. The results are placed in
- * 'list' itself.
- *
- * The "mode" argument controls the handling of any DEFINED tokens that
- * result from expansion as follows:
- *
- * EXPANSION_MODE_IGNORE_DEFINED: Any resulting DEFINED tokens will be
- * left in the final list, unevaluated. This is the correct mode
- * for expanding any list in any context other than a
- * preprocessor conditional, (#if or #elif).
- *
- * EXPANSION_MODE_EVALUATE_DEFINED: Any resulting DEFINED tokens will be
- * evaluated to 0 or 1 tokens depending on whether the following
- * token is the name of a defined macro. If the DEFINED token is
- * not followed by an (optionally parenthesized) identifier, then
- * an error will be generated. This the correct mode for
- * expanding any list in the context of a preprocessor
- * conditional, (#if or #elif).
+ * 'list' itself;
*/
static void
_glcpp_parser_expand_token_list (glcpp_parser_t *parser,
- token_list_t *list,
- expansion_mode_t mode)
+ token_list_t *list)
{
token_node_t *node_prev;
token_node_t *node, *last = NULL;
@@ -4255,23 +3947,15 @@ _glcpp_parser_expand_token_list (glcpp_parser_t *parser,
node_prev = NULL;
node = list->head;
- if (mode == EXPANSION_MODE_EVALUATE_DEFINED)
- _glcpp_parser_evaluate_defined_in_list (parser, list);
-
while (node) {
while (parser->active && parser->active->marker == node)
_parser_active_list_pop (parser);
- expansion = _glcpp_parser_expand_node (parser, node, &last, mode);
+ expansion = _glcpp_parser_expand_node (parser, node, &last);
if (expansion) {
token_node_t *n;
- if (mode == EXPANSION_MODE_EVALUATE_DEFINED) {
- _glcpp_parser_evaluate_defined_in_list (parser,
- expansion);
- }
-
for (n = node; n != last->next; n = n->next)
while (parser->active &&
parser->active->marker == n)
@@ -4324,7 +4008,7 @@ _glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser,
if (list == NULL)
return;
- _glcpp_parser_expand_token_list (parser, list, EXPANSION_MODE_IGNORE_DEFINED);
+ _glcpp_parser_expand_token_list (parser, list);
_token_list_trim_trailing_space (list);
@@ -4385,10 +4069,6 @@ _define_object_macro (glcpp_parser_t *parser,
{
macro_t *macro, *previous;
- /* We define pre-defined macros before we've started parsing the
- * actual file. So if there's no location defined yet, that's what
- * were doing and we don't want to generate an error for using the
- * reserved names. */
if (loc != NULL)
_check_for_reserved_macro_name(parser, loc, identifier);
@@ -4421,16 +4101,9 @@ _define_function_macro (glcpp_parser_t *parser,
token_list_t *replacements)
{
macro_t *macro, *previous;
- const char *dup;
_check_for_reserved_macro_name(parser, loc, identifier);
- /* Check for any duplicate parameter names. */
- if ((dup = _string_list_has_duplicate (parameters)) != NULL) {
- glcpp_error (loc, parser, "Duplicate macro parameter \"%s\"",
- dup);
- }
-
macro = ralloc (parser, macro_t);
ralloc_steal (macro, parameters);
ralloc_steal (macro, replacements);
@@ -4493,11 +4166,11 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser)
if (ret == NEWLINE)
parser->in_control_line = 0;
}
- else if (ret == DEFINE_TOKEN ||
- ret == UNDEF || ret == IF ||
- ret == IFDEF || ret == IFNDEF ||
- ret == ELIF || ret == ELSE ||
- ret == ENDIF || ret == HASH_TOKEN)
+ else if (ret == HASH_DEFINE ||
+ ret == HASH_UNDEF || ret == HASH_IF ||
+ ret == HASH_IFDEF || ret == HASH_IFNDEF ||
+ ret == HASH_ELIF || ret == HASH_ELSE ||
+ ret == HASH_ENDIF || ret == HASH)
{
parser->in_control_line = 1;
}
@@ -4590,7 +4263,7 @@ _glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc,
const char *type, int condition)
{
if (parser->skip_stack == NULL) {
- glcpp_error (loc, parser, "#%s without #if\n", type);
+ glcpp_error (loc, parser, "%s without #if\n", type);
return;
}
@@ -4643,8 +4316,6 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
if (extensions != NULL) {
if (extensions->OES_EGL_image_external)
add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
- if (extensions->OES_standard_derivatives)
- add_builtin_define(parser, "GL_OES_standard_derivatives", 1);
}
} else {
add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
@@ -4664,15 +4335,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
add_builtin_define(parser, "GL_ARB_fragment_coord_conventions",
1);
- if (extensions->ARB_fragment_layer_viewport)
- add_builtin_define(parser, "GL_ARB_fragment_layer_viewport", 1);
-
if (extensions->ARB_explicit_attrib_location)
add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1);
- if (extensions->ARB_explicit_uniform_location)
- add_builtin_define(parser, "GL_ARB_explicit_uniform_location", 1);
-
if (extensions->ARB_shader_texture_lod)
add_builtin_define(parser, "GL_ARB_shader_texture_lod", 1);
@@ -4711,9 +4376,6 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
if (extensions->AMD_vertex_shader_layer)
add_builtin_define(parser, "GL_AMD_vertex_shader_layer", 1);
- if (extensions->AMD_vertex_shader_viewport_index)
- add_builtin_define(parser, "GL_AMD_vertex_shader_viewport_index", 1);
-
if (extensions->ARB_shading_language_420pack)
add_builtin_define(parser, "GL_ARB_shading_language_420pack", 1);
@@ -4734,9 +4396,6 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
if (extensions->ARB_shader_image_load_store)
add_builtin_define(parser, "GL_ARB_shader_image_load_store", 1);
-
- if (extensions->ARB_derivative_control)
- add_builtin_define(parser, "GL_ARB_derivative_control", 1);
}
}