/* A Bison parser, made from ./parser.y by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ # define TOK_ANY 257 # define TOK_ATTRIBUTE 258 # define TOK_BOOLEAN 259 # define TOK_CASE 260 # define TOK_CHAR 261 # define TOK_CONST 262 # define TOK_CONTEXT 263 # define TOK_DEFAULT 264 # define TOK_DOUBLE 265 # define TOK_ENUM 266 # define TOK_EXCEPTION 267 # define TOK_FALSE 268 # define TOK_FIXED 269 # define TOK_FLOAT 270 # define TOK_IN 271 # define TOK_INOUT 272 # define TOK_INTERFACE 273 # define TOK_LONG 274 # define TOK_MODULE 275 # define TOK_NATIVE 276 # define TOK_OBJECT 277 # define TOK_OCTET 278 # define TOK_ONEWAY 279 # define TOK_OP_SCOPE 280 # define TOK_OP_SHL 281 # define TOK_OP_SHR 282 # define TOK_OUT 283 # define TOK_RAISES 284 # define TOK_READONLY 285 # define TOK_SEQUENCE 286 # define TOK_SHORT 287 # define TOK_STRING 288 # define TOK_STRUCT 289 # define TOK_SWITCH 290 # define TOK_TRUE 291 # define TOK_TYPECODE 292 # define TOK_TYPEDEF 293 # define TOK_UNION 294 # define TOK_UNSIGNED 295 # define TOK_VARARGS 296 # define TOK_VOID 297 # define TOK_WCHAR 298 # define TOK_WSTRING 299 # define TOK_FLOATP 300 # define TOK_INTEGER 301 # define TOK_DECLSPEC 302 # define TOK_PROP_KEY 303 # define TOK_PROP_VALUE 304 # define TOK_NATIVE_TYPE 305 # define TOK_IDENT 306 # define TOK_SQSTRING 307 # define TOK_DQSTRING 308 # define TOK_FIXEDP 309 # define TOK_CODEFRAG 310 #line 24 "./parser.y" #include #include #include #include #include #include #include #include "rename.h" #include "util.h" #define REF_IDENTS #define do_binop(rv,op,a,b) do { \ if (IDL_binop_chktypes (op, a, b)) \ YYABORT; \ if (!(__IDL_flags & IDLF_NO_EVAL_CONST)) { \ rv = IDL_binop_eval (op, a, b); \ IDL_tree_free (a); \ IDL_tree_free (b); \ if (!rv) YYABORT; \ } else { \ rv = IDL_binop_new (op, a, b); \ } \ } while (0) #define do_unaryop(rv,op,a) do { \ if (IDL_unaryop_chktypes (op, a)) \ YYABORT; \ if (!(__IDL_flags & IDLF_NO_EVAL_CONST)) { \ rv = IDL_unaryop_eval (op, a); \ IDL_tree_free (a); \ if (!rv) YYABORT; \ } else { \ rv = IDL_unaryop_new (op, a); \ } \ } while (0) #define assign_declspec(tree,declspec) do { \ IDL_NODE_DECLSPEC (tree) = declspec; \ if (__IDL_inhibits > 0 || \ (__IDL_flags & IDLF_INHIBIT_INCLUDES && \ __IDL_flagsi & IDLFP_IN_INCLUDES)) { \ IDL_NODE_DECLSPEC (tree) |= \ IDLF_DECLSPEC_EXIST | \ IDLF_DECLSPEC_INHIBIT; \ } \ } while (0) #define assign_props(tree,props) do { \ if (__IDL_flags & IDLF_PROPERTIES) \ IDL_NODE_PROPERTIES (tree) = (props); \ else \ __IDL_free_properties (props); \ } while (0) extern int yylex (void); static IDL_declspec_t IDL_parse_declspec (const char *strspec); static int IDL_binop_chktypes (enum IDL_binop op, IDL_tree a, IDL_tree b); static int IDL_unaryop_chktypes (enum IDL_unaryop op, IDL_tree a); static IDL_tree IDL_binop_eval (enum IDL_binop op, IDL_tree a, IDL_tree b); static IDL_tree IDL_unaryop_eval (enum IDL_unaryop op, IDL_tree a); static IDL_tree list_start (IDL_tree a, gboolean filter_null); static IDL_tree list_chain (IDL_tree a, IDL_tree b, gboolean filter_null); static IDL_tree zlist_chain (IDL_tree a, IDL_tree b, gboolean filter_null); static int do_token_error (IDL_tree p, const char *message, gboolean prev); static void illegal_context_type_error (IDL_tree p, const char *what); static void illegal_type_error (IDL_tree p, const char *message); #line 109 "./parser.y" #ifndef YYSTYPE typedef union { IDL_tree tree; struct { IDL_tree tree; gpointer data; } treedata; GHashTable *hash_table; char *str; gboolean boolean; IDL_declspec_t declspec; IDL_longlong_t integer; double floatp; enum IDL_unaryop unaryop; enum IDL_param_attr paramattr; } yystype; # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif #ifndef YYDEBUG # define YYDEBUG 0 #endif #define YYFINAL 394 #define YYFLAG -32768 #define YYNTBASE 78 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ #define YYTRANSLATE(x) ((unsigned)(x) <= 310 ? yytranslate[x] : 224) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ 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, 72, 67, 2, 62, 63, 70, 68, 58, 69, 2, 71, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 61, 57, 74, 64, 75, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 76, 2, 77, 66, 2, 2, 2, 2, 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, 65, 60, 73, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 }; #if YYDEBUG static const short yyprhs[] = { 0, 0, 1, 3, 4, 6, 8, 11, 13, 14, 16, 18, 19, 21, 24, 27, 30, 33, 36, 38, 40, 42, 45, 46, 54, 56, 58, 60, 61, 62, 75, 81, 82, 85, 87, 91, 93, 94, 97, 100, 103, 106, 109, 112, 114, 116, 119, 123, 125, 127, 129, 133, 134, 141, 144, 146, 148, 150, 152, 154, 156, 158, 160, 161, 163, 164, 166, 167, 168, 178, 179, 180, 194, 196, 198, 200, 202, 204, 206, 208, 211, 215, 218, 220, 223, 227, 230, 233, 239, 242, 249, 250, 253, 254, 256, 259, 260, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 288, 290, 293, 302, 303, 306, 308, 309, 311, 312, 315, 320, 324, 326, 330, 331, 337, 339, 341, 343, 345, 346, 348, 349, 351, 356, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379, 381, 383, 387, 389, 393, 395, 399, 401, 405, 409, 411, 415, 419, 421, 425, 429, 433, 436, 438, 440, 442, 444, 446, 448, 452, 454, 456, 458, 460, 462, 464, 465, 473, 475, 477, 480, 484, 486, 490, 492, 495, 499, 501, 503, 505, 507, 509, 511, 513, 515, 517, 519, 521, 523, 525, 532, 537, 539, 541, 544, 551, 553, 555, 557, 559, 561, 563, 565, 567, 570, 572, 574, 576, 579, 582, 586, 588, 590, 592, 594, 596, 598, 600, 605, 607, 612, 614, 616, 620, 622, 624, 626, 628, 630, 634, 637, 639, 642, 646, 649, 652, 657, 659, 663, 665, 667, 669, 671, 672, 674, 676, 678, 680, 682, 686, 688, 689, 691, 692, 693, 698, 700, 702, 704, 706, 708, 710, 712, 715, 717, 720, 722 }; static const short yyrhs[] = { -1, 80, 0, 0, 80, 0, 85, 0, 80, 85, 0, 57, 0, 0, 57, 0, 58, 0, 0, 162, 0, 98, 81, 0, 120, 81, 0, 122, 81, 0, 90, 81, 0, 87, 81, 0, 220, 0, 84, 0, 82, 0, 211, 21, 0, 0, 86, 203, 88, 59, 79, 60, 204, 0, 203, 0, 23, 0, 38, 0, 0, 0, 211, 212, 19, 89, 91, 204, 93, 92, 59, 95, 60, 204, 0, 211, 212, 19, 89, 204, 0, 0, 61, 94, 0, 162, 0, 94, 83, 162, 0, 96, 0, 0, 96, 97, 0, 98, 81, 0, 122, 81, 0, 133, 81, 0, 126, 81, 0, 120, 81, 0, 220, 0, 82, 0, 211, 99, 0, 212, 39, 101, 0, 107, 0, 110, 0, 160, 0, 212, 22, 193, 0, 0, 212, 22, 193, 62, 100, 51, 0, 102, 191, 0, 103, 0, 104, 0, 167, 0, 168, 0, 162, 0, 107, 0, 110, 0, 160, 0, 0, 201, 0, 0, 202, 0, 0, 0, 212, 35, 108, 106, 59, 109, 165, 60, 204, 0, 0, 0, 212, 40, 111, 106, 36, 62, 113, 63, 59, 112, 114, 60, 204, 0, 173, 0, 182, 0, 184, 0, 160, 0, 162, 0, 115, 0, 116, 0, 115, 116, 0, 118, 117, 81, 0, 102, 192, 0, 119, 0, 118, 119, 0, 6, 149, 61, 0, 10, 61, 0, 211, 121, 0, 8, 148, 201, 64, 149, 0, 211, 123, 0, 13, 202, 59, 124, 60, 204, 0, 0, 124, 166, 0, 0, 31, 0, 211, 127, 0, 0, 212, 125, 4, 128, 129, 195, 0, 131, 0, 43, 0, 169, 0, 104, 0, 167, 0, 189, 0, 190, 0, 171, 0, 162, 0, 130, 0, 0, 25, 0, 211, 134, 0, 212, 132, 135, 202, 139, 204, 144, 145, 0, 0, 136, 131, 0, 43, 0, 0, 42, 0, 0, 58, 42, 0, 62, 140, 138, 63, 0, 62, 137, 63, 0, 141, 0, 140, 83, 141, 0, 0, 212, 143, 142, 129, 193, 0, 17, 0, 29, 0, 18, 0, 129, 0, 0, 146, 0, 0, 147, 0, 30, 62, 94, 63, 0, 9, 62, 209, 63, 0, 173, 0, 182, 0, 183, 0, 184, 0, 170, 0, 189, 0, 190, 0, 172, 0, 162, 0, 150, 0, 151, 0, 150, 65, 151, 0, 152, 0, 151, 66, 152, 0, 153, 0, 152, 67, 153, 0, 154, 0, 153, 28, 154, 0, 153, 27, 154, 0, 155, 0, 154, 68, 155, 0, 154, 69, 155, 0, 156, 0, 155, 70, 156, 0, 155, 71, 156, 0, 155, 72, 156, 0, 157, 158, 0, 158, 0, 69, 0, 68, 0, 73, 0, 162, 0, 159, 0, 62, 149, 63, 0, 214, 0, 215, 0, 216, 0, 217, 0, 218, 0, 219, 0, 0, 212, 12, 161, 105, 59, 164, 60, 0, 163, 0, 206, 0, 26, 208, 0, 163, 26, 200, 0, 201, 0, 164, 83, 201, 0, 166, 0, 165, 166, 0, 102, 191, 81, 0, 170, 0, 173, 0, 182, 0, 183, 0, 184, 0, 185, 0, 186, 0, 187, 0, 188, 0, 169, 0, 189, 0, 190, 0, 171, 0, 32, 74, 103, 58, 210, 75, 0, 32, 74, 103, 75, 0, 16, 0, 11, 0, 20, 11, 0, 15, 74, 210, 58, 214, 75, 0, 15, 0, 174, 0, 178, 0, 175, 0, 176, 0, 177, 0, 33, 0, 20, 0, 20, 20, 0, 179, 0, 180, 0, 181, 0, 41, 33, 0, 41, 20, 0, 41, 20, 20, 0, 7, 0, 44, 0, 5, 0, 24, 0, 3, 0, 23, 0, 38, 0, 34, 74, 210, 75, 0, 34, 0, 45, 74, 210, 75, 0, 45, 0, 192, 0, 191, 83, 192, 0, 193, 0, 194, 0, 201, 0, 196, 0, 193, 0, 195, 83, 193, 0, 201, 197, 0, 198, 0, 197, 198, 0, 76, 210, 77, 0, 76, 77, 0, 49, 50, 0, 199, 58, 49, 50, 0, 49, 0, 199, 58, 49, 0, 52, 0, 205, 0, 205, 0, 207, 0, 0, 200, 0, 200, 0, 200, 0, 200, 0, 215, 0, 209, 83, 215, 0, 149, 0, 0, 48, 0, 0, 0, 76, 213, 199, 77, 0, 47, 0, 221, 0, 223, 0, 55, 0, 46, 0, 37, 0, 14, 0, 211, 56, 0, 222, 0, 221, 222, 0, 54, 0, 53, 0 }; #endif #if YYDEBUG /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { 0, 299, 300, 303, 304, 307, 308, 311, 312, 318, 324, 325, 331, 340, 341, 342, 343, 344, 345, 346, 347, 350, 353, 353, 389, 390, 394, 400, 400, 400, 438, 451, 452, 498, 499, 503, 506, 507, 510, 511, 512, 513, 514, 515, 516, 519, 525, 538, 539, 540, 541, 546, 546, 562, 565, 566, 569, 570, 571, 574, 575, 576, 579, 583, 586, 590, 593, 593, 593, 608, 608, 608, 625, 626, 627, 628, 629, 632, 635, 636, 639, 643, 657, 658, 661, 662, 665, 671, 678, 684, 689, 690, 693, 694, 697, 703, 703, 722, 723, 729, 731, 734, 735, 736, 737, 738, 739, 745, 746, 749, 755, 767, 767, 769, 772, 773, 776, 777, 780, 787, 793, 794, 798, 798, 808, 809, 810, 811, 817, 818, 821, 822, 825, 830, 835, 836, 837, 838, 839, 840, 841, 842, 843, 846, 849, 850, 853, 854, 857, 858, 861, 862, 863, 866, 867, 868, 871, 872, 873, 874, 877, 878, 881, 882, 883, 886, 900, 901, 904, 905, 906, 907, 908, 909, 912, 912, 922, 930, 931, 932, 961, 962, 966, 967, 970, 985, 986, 987, 988, 989, 990, 991, 992, 993, 996, 997, 998, 999, 1002, 1005, 1010, 1011, 1012, 1015, 1020, 1023, 1024, 1027, 1028, 1029, 1032, 1035, 1038, 1041, 1042, 1043, 1046, 1049, 1052, 1055, 1058, 1061, 1064, 1067, 1070, 1073, 1076, 1079, 1082, 1085, 1088, 1089, 1093, 1094, 1097, 1100, 1103, 1104, 1108, 1123, 1124, 1128, 1129, 1132, 1137, 1143, 1147, 1154, 1157, 1165, 1177, 1193, 1203, 1241, 1259, 1284, 1303, 1304, 1308, 1346, 1347, 1353, 1354, 1354, 1366, 1369, 1372, 1375, 1378, 1381, 1382, 1385, 1391, 1392, 1400, 1407 }; #endif #if (YYDEBUG) || defined YYERROR_VERBOSE /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ static const char *const yytname[] = { "$", "error", "$undefined.", "TOK_ANY", "TOK_ATTRIBUTE", "TOK_BOOLEAN", "TOK_CASE", "TOK_CHAR", "TOK_CONST", "TOK_CONTEXT", "TOK_DEFAULT", "TOK_DOUBLE", "TOK_ENUM", "TOK_EXCEPTION", "TOK_FALSE", "TOK_FIXED", "TOK_FLOAT", "TOK_IN", "TOK_INOUT", "TOK_INTERFACE", "TOK_LONG", "TOK_MODULE", "TOK_NATIVE", "TOK_OBJECT", "TOK_OCTET", "TOK_ONEWAY", "TOK_OP_SCOPE", "TOK_OP_SHL", "TOK_OP_SHR", "TOK_OUT", "TOK_RAISES", "TOK_READONLY", "TOK_SEQUENCE", "TOK_SHORT", "TOK_STRING", "TOK_STRUCT", "TOK_SWITCH", "TOK_TRUE", "TOK_TYPECODE", "TOK_TYPEDEF", "TOK_UNION", "TOK_UNSIGNED", "TOK_VARARGS", "TOK_VOID", "TOK_WCHAR", "TOK_WSTRING", "TOK_FLOATP", "TOK_INTEGER", "TOK_DECLSPEC", "TOK_PROP_KEY", "TOK_PROP_VALUE", "TOK_NATIVE_TYPE", "TOK_IDENT", "TOK_SQSTRING", "TOK_DQSTRING", "TOK_FIXEDP", "TOK_CODEFRAG", "';'", "','", "'{'", "'}'", "':'", "'('", "')'", "'='", "'|'", "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'", "'~'", "'<'", "'>'", "'['", "']'", "specification", "z_definition_list", "definition_list", "check_semicolon", "useless_semicolon", "check_comma", "illegal_ident", "definition", "module_declspec", "module", "@1", "interface_catch_ident", "interface", "@2", "@3", "z_inheritance", "scoped_name_list", "interface_body", "export_list", "export", "type_dcl", "type_dcl_def", "@4", "type_declarator", "type_spec", "simple_type_spec", "constr_type_spec", "z_new_ident_catch", "z_new_scope_catch", "struct_type", "@5", "@6", "union_type", "@7", "@8", "switch_type_spec", "switch_body", "case_stmt_list", "case_stmt", "element_spec", "case_label_list", "case_label", "const_dcl", "const_dcl_def", "except_dcl", "except_dcl_def", "member_zlist", "is_readonly", "attr_dcl", "attr_dcl_def", "@9", "param_type_spec", "op_param_type_spec_illegal", "op_param_type_spec", "is_oneway", "op_dcl", "op_dcl_def", "op_type_spec", "@10", "is_varargs", "is_cvarargs", "parameter_dcls", "param_dcl_list", "param_dcl", "@11", "param_attribute", "is_raises_expr", "is_context_expr", "raises_expr", "context_expr", "const_type", "const_exp", "or_expr", "xor_expr", "and_expr", "shift_expr", "add_expr", "mult_expr", "unary_expr", "unary_op", "primary_expr", "literal", "enum_type", "@12", "scoped_name", "ns_scoped_name", "enumerator_list", "member_list", "member", "base_type_spec", "template_type_spec", "sequence_type", "floating_pt_type", "fixed_pt_type", "fixed_pt_const_type", "integer_type", "signed_int", "signed_short_int", "signed_long_int", "signed_longlong_int", "unsigned_int", "unsigned_short_int", "unsigned_long_int", "unsigned_longlong_int", "char_type", "wide_char_type", "boolean_type", "octet_type", "any_type", "object_type", "typecode_type", "string_type", "wide_string_type", "declarator_list", "declarator", "simple_declarator", "complex_declarator", "simple_declarator_list", "array_declarator", "fixed_array_size_list", "fixed_array_size", "prop_hash", "ident", "new_ident", "new_scope", "new_or_prev_scope", "pop_scope", "ns_new_ident", "ns_prev_ident", "cur_ns_new_or_prev_ident", "ns_global_ident", "string_lit_list", "positive_int_const", "z_declspec", "z_props", "@13", "integer_lit", "string_lit", "char_lit", "fixed_pt_lit", "floating_pt_lit", "boolean_lit", "codefrag", "dqstring_cat", "dqstring", "sqstring", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { 0, 78, 78, 79, 79, 80, 80, 81, 81, 82, 83, 83, 84, 85, 85, 85, 85, 85, 85, 85, 85, 86, 88, 87, 89, 89, 89, 91, 92, 90, 90, 93, 93, 94, 94, 95, 96, 96, 97, 97, 97, 97, 97, 97, 97, 98, 99, 99, 99, 99, 99, 100, 99, 101, 102, 102, 103, 103, 103, 104, 104, 104, 105, 105, 106, 106, 108, 109, 107, 111, 112, 110, 113, 113, 113, 113, 113, 114, 115, 115, 116, 117, 118, 118, 119, 119, 120, 121, 122, 123, 124, 124, 125, 125, 126, 128, 127, 129, 129, 130, 130, 131, 131, 131, 131, 131, 131, 132, 132, 133, 134, 136, 135, 135, 137, 137, 138, 138, 139, 139, 140, 140, 142, 141, 143, 143, 143, 143, 144, 144, 145, 145, 146, 147, 148, 148, 148, 148, 148, 148, 148, 148, 148, 149, 150, 150, 151, 151, 152, 152, 153, 153, 153, 154, 154, 154, 155, 155, 155, 155, 156, 156, 157, 157, 157, 158, 158, 158, 159, 159, 159, 159, 159, 159, 161, 160, 162, 163, 163, 163, 164, 164, 165, 165, 166, 167, 167, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 169, 169, 170, 170, 170, 171, 172, 173, 173, 174, 174, 174, 175, 176, 177, 178, 178, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 189, 190, 190, 191, 191, 192, 192, 193, 194, 195, 195, 196, 197, 197, 198, 198, 199, 199, 199, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 211, 212, 213, 212, 214, 215, 216, 217, 218, 219, 219, 220, 221, 221, 222, 223 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { 0, 0, 1, 0, 1, 1, 2, 1, 0, 1, 1, 0, 1, 2, 2, 2, 2, 2, 1, 1, 1, 2, 0, 7, 1, 1, 1, 0, 0, 12, 5, 0, 2, 1, 3, 1, 0, 2, 2, 2, 2, 2, 2, 1, 1, 2, 3, 1, 1, 1, 3, 0, 6, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 9, 0, 0, 13, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 2, 3, 2, 2, 5, 2, 6, 0, 2, 0, 1, 2, 0, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 8, 0, 2, 1, 0, 1, 0, 2, 4, 3, 1, 3, 0, 5, 1, 1, 1, 1, 0, 1, 0, 1, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 2, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 0, 7, 1, 1, 2, 3, 1, 3, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 4, 1, 1, 2, 6, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 4, 1, 4, 1, 1, 3, 1, 1, 1, 1, 1, 3, 2, 1, 2, 3, 2, 2, 4, 1, 3, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 3, 1, 0, 1, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const short yydefact[] = { 259, 0, 260, 247, 9, 259, 20, 19, 5, 0, 8, 8, 8, 8, 8, 12, 176, 253, 177, 261, 18, 255, 178, 6, 254, 22, 250, 7, 17, 16, 13, 14, 15, 0, 0, 0, 21, 271, 262, 45, 47, 48, 86, 88, 49, 0, 0, 179, 221, 219, 201, 204, 200, 211, 210, 227, 0, 220, 229, 0, 142, 138, 141, 134, 205, 207, 208, 209, 206, 213, 214, 215, 135, 136, 137, 139, 140, 252, 0, 249, 0, 174, 0, 0, 66, 261, 69, 259, 202, 212, 0, 217, 216, 0, 0, 248, 90, 245, 0, 62, 25, 26, 251, 24, 50, 234, 64, 223, 0, 224, 222, 0, 225, 46, 0, 54, 55, 59, 60, 61, 58, 56, 57, 194, 185, 197, 186, 187, 188, 189, 190, 191, 192, 193, 195, 196, 0, 64, 0, 259, 270, 269, 268, 264, 275, 274, 267, 0, 163, 162, 164, 258, 143, 144, 146, 148, 150, 153, 156, 0, 161, 166, 165, 0, 168, 169, 170, 171, 172, 173, 265, 272, 266, 218, 0, 0, 261, 243, 0, 263, 0, 63, 251, 30, 51, 0, 65, 0, 0, 53, 230, 232, 233, 235, 234, 0, 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 226, 273, 228, 87, 251, 0, 91, 246, 0, 31, 0, 67, 0, 0, 10, 0, 0, 238, 239, 0, 23, 167, 145, 147, 149, 152, 151, 154, 155, 157, 158, 159, 89, 8, 244, 11, 180, 0, 28, 52, 261, 0, 0, 199, 231, 242, 0, 240, 261, 184, 175, 0, 11, 33, 0, 261, 182, 0, 0, 241, 211, 0, 75, 76, 72, 73, 74, 0, 181, 0, 36, 251, 183, 203, 198, 0, 34, 0, 259, 68, 70, 251, 44, 37, 8, 8, 8, 8, 8, 261, 43, 0, 29, 38, 42, 39, 41, 40, 94, 109, 107, 0, 0, 0, 77, 78, 261, 82, 108, 93, 0, 111, 0, 85, 251, 79, 0, 8, 83, 95, 113, 0, 261, 84, 71, 81, 80, 261, 0, 100, 106, 112, 105, 101, 99, 104, 102, 103, 98, 0, 97, 261, 251, 236, 96, 115, 0, 11, 120, 261, 128, 0, 119, 10, 261, 0, 124, 126, 125, 127, 122, 0, 130, 129, 237, 117, 121, 118, 261, 0, 0, 110, 131, 0, 11, 0, 123, 132, 11, 256, 133, 0, 257, 0, 0, 0 }; static const short yydefgoto[] = { 392, 138, 5, 28, 6, 224, 7, 8, 9, 10, 46, 102, 11, 182, 263, 247, 261, 286, 287, 292, 12, 39, 219, 113, 214, 115, 116, 180, 185, 117, 106, 249, 118, 137, 300, 270, 312, 313, 314, 326, 315, 316, 13, 42, 14, 43, 176, 319, 296, 307, 336, 348, 339, 349, 320, 297, 308, 330, 331, 355, 364, 351, 356, 357, 377, 369, 371, 380, 372, 381, 59, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 119, 99, 162, 16, 244, 264, 215, 121, 122, 123, 124, 125, 62, 126, 64, 65, 66, 67, 68, 69, 70, 71, 127, 128, 129, 130, 131, 132, 133, 134, 135, 189, 190, 191, 192, 353, 193, 226, 227, 98, 17, 105, 186, 25, 183, 95, 18, 26, 22, 387, 163, 19, 136, 80, 164, 165, 166, 167, 168, 169, 20, 170, 171, 172 }; static const short yypact[] = { 36, 25,-32768,-32768,-32768, 76,-32768,-32768,-32768, 25, 34, 34, 34, 34, 34,-32768, 14,-32768,-32768, 43, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 25, 640, 25,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 249, -2,-32768,-32768,-32768, -32768,-32768,-32768, 27,-32768, 20, 112,-32768, 44, 25, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 81,-32768, 61,-32768, 23, 25,-32768, 553,-32768, 125,-32768,-32768, 564, 127,-32768, 564, 85,-32768,-32768, 126, -29, 25, -32768,-32768, 6,-32768, 108,-32768, 25,-32768, 118,-32768, -32768, 123,-32768,-32768, 25,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, 154, 25, 139, 172, -32768,-32768,-32768,-32768,-32768,-32768,-32768, 564,-32768,-32768, -32768,-32768, 145, 124, 169, 130, 146, 136,-32768, 211, -32768,-32768,-32768, 144,-32768,-32768,-32768,-32768,-32768,-32768, 167,-32768,-32768,-32768, 163, 564, 415,-32768, 194,-32768, 188,-32768,-32768,-32768,-32768, 196,-32768, 564, 620, 54, -32768,-32768,-32768,-32768, 180, 224,-32768, 209, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,-32768,-32768, -32768,-32768,-32768,-32768, 25,-32768, 225, 25, 213, 226, -32768, 218, -4,-32768, 25, 149, 180,-32768, 216,-32768, -32768, 124, 169, 130, 146, 146, 136, 136,-32768,-32768, -32768,-32768, 170,-32768, -15,-32768, 11,-32768,-32768, 553, 234, 564,-32768,-32768,-32768, 205,-32768, 115,-32768,-32768, 25, 191,-32768, 228, 461,-32768, 210, 215,-32768, 271, 229,-32768,-32768,-32768,-32768,-32768, 286,-32768, 11,-32768, -32768,-32768,-32768,-32768, 247,-32768, 251, 152,-32768,-32768, -32768,-32768,-32768, 34, 34, 34, 34, 34, 47,-32768, 140,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 303, 564, 248, 252, 140,-32768, 63,-32768,-32768,-32768, 309, 273, 253,-32768,-32768,-32768, 25, 34,-32768,-32768,-32768, 25, 553,-32768,-32768,-32768,-32768, 507, 255,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 25,-32768, 79,-32768,-32768, 54,-32768, 256, 51,-32768, 369, 288, 25,-32768, 279, 246, 260,-32768,-32768,-32768,-32768,-32768, 269, 324,-32768,-32768,-32768,-32768,-32768, 507, 11, 275, -32768,-32768, 25, 116, 167,-32768,-32768, 120,-32768,-32768, 167,-32768, 335, 339,-32768 }; static const short yypgoto[] = { -32768,-32768, 257, 0, 53, -219,-32768, 22,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, -30,-32768,-32768,-32768, 64,-32768,-32768,-32768, -69, 162, -305,-32768, 217, 1, -32768,-32768, 4,-32768,-32768,-32768,-32768,-32768, 39,-32768, -32768, 38, 68,-32768, 69,-32768,-32768,-32768,-32768,-32768, -32768, -328,-32768, 26,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, -5,-32768,-32768,-32768,-32768,-32768,-32768, -32768, -123,-32768, 164, 161, 165, 29, 49, 28,-32768, 202,-32768, -12,-32768, 5,-32768,-32768,-32768, -164, -206, -32768, -205, 330, -193,-32768, -17,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, -16, 332, -13,-32768,-32768,-32768, -32768, -31, -28, 153, -196, -81,-32768,-32768,-32768,-32768, 142,-32768, -1, -55, -20, 287, -163, -26,-32768,-32768, -32768,-32768, -71, 83, -18,-32768, 121, -349,-32768,-32768, -32768,-32768, 86,-32768, 207,-32768 }; #define YYLAST 692 static const short yytable[] = { 21, 45, 104, 75, 94, 15, 76, 44, 24, 79, 15, 29, 30, 31, 32, 78, 114, 63, 72, 218, 40, 74, 174, 41, 197, 260, 338, 23, 253, 178, 368, 338, 47, 229, 77, 388, -1, 1, 88, 60, 33, 391, 278, 223, 181, 259, 100, 89, 179, 382, 241, 34, 212, 338, 251, 34, 35, 87, 77, 194, 35, 101, 1, 3, 36, -27, 107, -27, 48, 310, 49, 252, 338, 311, 50, 3, -2, 3, 108, 52, 79, 24, 77, 53, 2, 265, 109, 110, 3, 1, 120, 27, 15, 4, 90, 111, 54, 55, 77, 37, 281, 112, 1, 37, 56, 77, -11, 57, 58, 362, 97, 79, 223, 77, -116, 3, 221, 288, 93, 38, 48, 354, 49, 38, 2, 342, 343, 301, 3, 334, 342, 343, 91, 4, 360, 269, 77, 363, 344, 38, 96, 1, -114, 344, 15, 92, 310, 173, 54, 175, 311, 1, 342, 343, 255, 38, 56, 201, 202, 194, 333, 23, 245, 140, 278, 344, 81, 3, 390, 194, 184, 342, 343, 2, 223, 1, 177, 3, 223, 386, 267, 120, 4, 389, 344, -3, 141, 321, 359, 84, 199, 38, 187, 120, 86, 142, 143, 188, 1, 196, 2, 3, 144, 145, 146, 277, 205, 206, 207, 4, 198, 147, -35, 77, 203, 204, 77, 148, 149, 209, 2, 145, 150, 77, 3, 140, 254, 27, 223, 4, 234, 235, -4, 238, 239, 240, 200, 1, 211, 276, 273, 274, 258, 216, 275, 271, 325, 217, 141, 223, -32, 262, 236, 237, 120, 220, 225, 142, 143, 77, 228, 81, 272, 3, 144, 145, 146, 352, 82, 120, 194, 83, 230, 147, 246, 243, 250, 248, 257, 373, 309, 143, 268, 285, 84, 282, 44, 279, 85, 86, 283, 89, 284, 302, 303, 304, 305, 306, 81, 40, 345, 385, 41, 346, 79, 345, 289, -92, 346, 322, 337, 290, 323, 328, 332, 81, 329, 350, 370, 361, 120, 374, 38, 376, 77, 83, 335, 345, 317, 77, 346, 378, 358, 379, 318, 393, 341, 384, 84, 394, 291, 341, 85, 86, 139, 358, 345, 77, 383, 346, 222, 293, 324, 327, 195, 294, 295, 340, 375, 77, 232, 208, 231, 341, 61, 233, 73, 242, 256, 103, 298, 266, 107, 299, 48, 0, 49, 210, 0, 0, 50, 77, 341, 262, 108, 52, 365, 366, 0, 53, 0, 0, 109, 110, 0, 1, 0, 0, 367, 0, 0, 111, 54, 55, 0, 0, 0, 112, 0, 0, 56, 0, 347, 57, 58, 0, 0, 0, 107, 0, 48, 3, 49, 0, 0, 0, 50, 0, 0, 0, 108, 52, 0, 0, 0, 53, 0, 0, 109, 110, 0, 1, 0, 0, 0, 38, 0, 111, 54, 55, 0, 0, 0, 112, 0, 0, 56, 0, 0, 57, 58, 0, 0, 0, 107, 0, 48, 3, 49, 0, 0, 0, 50, 0, 0, 213, 108, 52, 0, 0, 0, 53, 0, 0, 109, 110, 0, 1, 0, 0, 0, 38, 0, 111, 54, 55, 0, 0, 0, 112, 0, 0, 56, 0, 0, 57, 58, 0, 0, 0, 107, 0, 48, 3, 49, 0, 0, 0, 50, 0, 0, 280, 108, 52, 0, 0, 0, 53, 0, 0, 109, 110, 0, 1, 0, 0, 0, 38, 0, 111, 54, 55, 0, 0, 0, 112, 0, 0, 56, 0, 347, 57, 58, 0, 0, 0, 107, 0, 48, 3, 49, 0, 0, 0, 50, 0, 0, 0, 108, 52, 0, 0, 0, 53, 0, 0, 109, 110, 140, 1, 0, 0, 0, 38, 0, 111, 54, 55, 0, 0, 1, 112, 0, 0, 56, 0, 0, 57, 58, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 0, 142, 143, 0, 0, 0, 0, 3, 144, 145, 146, 0, 0, 0, 107, 0, 48, 147, 49, 0, 38, 0, 50, 148, 149, 0, 108, 52, 150, 0, 0, 53, 0, 0, 109, 110, 48, 1, 49, 0, 0, 0, 50, 111, 54, 55, 51, 52, 0, 112, 0, 53, 56, 0, 0, 57, 58, 1, 0, 0, 0, 0, 0, 3, 54, 55, 0, 0, 0, 0, 0, 0, 56, 0, 0, 57, 58, 0, 0, 0, 0, 0, 0, 3 }; static const short yycheck[] = { 1, 19, 83, 34, 59, 0, 34, 19, 9, 35, 5, 11, 12, 13, 14, 35, 85, 34, 34, 182, 19, 34, 93, 19, 147, 244, 331, 5, 224, 58, 358, 336, 33, 196, 35, 384, 0, 26, 11, 34, 26, 390, 261, 58, 99, 60, 23, 20, 77, 377, 213, 8, 175, 358, 58, 8, 13, 59, 59, 114, 13, 38, 26, 52, 21, 59, 3, 61, 5, 6, 7, 75, 377, 10, 11, 52, 0, 52, 15, 16, 106, 82, 83, 20, 48, 249, 23, 24, 52, 26, 85, 57, 87, 57, 74, 32, 33, 34, 99, 56, 264, 38, 26, 56, 41, 106, 52, 44, 45, 58, 49, 137, 58, 114, 63, 52, 187, 280, 74, 76, 5, 42, 7, 76, 48, 331, 331, 290, 52, 325, 336, 336, 20, 57, 353, 20, 137, 356, 331, 76, 59, 26, 63, 336, 139, 33, 6, 20, 33, 64, 10, 26, 358, 358, 225, 76, 41, 27, 28, 214, 323, 139, 217, 14, 383, 358, 12, 52, 387, 224, 62, 377, 377, 48, 58, 26, 50, 52, 58, 63, 251, 176, 57, 63, 377, 60, 37, 310, 351, 35, 66, 76, 74, 188, 40, 46, 47, 74, 26, 60, 48, 52, 53, 54, 55, 260, 70, 71, 72, 57, 65, 62, 60, 214, 68, 69, 217, 68, 69, 75, 48, 54, 73, 224, 52, 14, 77, 57, 58, 57, 201, 202, 60, 205, 206, 207, 67, 26, 75, 257, 257, 257, 242, 49, 257, 257, 315, 59, 37, 58, 59, 246, 203, 204, 249, 59, 76, 46, 47, 260, 36, 12, 257, 52, 53, 54, 55, 348, 19, 264, 325, 22, 63, 62, 61, 50, 58, 51, 62, 360, 298, 47, 77, 278, 35, 75, 298, 59, 39, 40, 75, 20, 63, 293, 294, 295, 296, 297, 12, 298, 331, 382, 298, 331, 330, 336, 59, 4, 336, 61, 330, 60, 60, 4, 61, 12, 43, 62, 30, 63, 315, 42, 76, 63, 325, 22, 326, 358, 25, 330, 358, 62, 350, 9, 31, 0, 331, 62, 35, 0, 287, 336, 39, 40, 87, 363, 377, 348, 378, 377, 188, 287, 313, 315, 137, 287, 287, 331, 363, 360, 199, 159, 198, 358, 34, 200, 34, 214, 226, 82, 287, 250, 3, 287, 5, -1, 7, 170, -1, -1, 11, 382, 377, 378, 15, 16, 17, 18, -1, 20, -1, -1, 23, 24, -1, 26, -1, -1, 29, -1, -1, 32, 33, 34, -1, -1, -1, 38, -1, -1, 41, -1, 43, 44, 45, -1, -1, -1, 3, -1, 5, 52, 7, -1, -1, -1, 11, -1, -1, -1, 15, 16, -1, -1, -1, 20, -1, -1, 23, 24, -1, 26, -1, -1, -1, 76, -1, 32, 33, 34, -1, -1, -1, 38, -1, -1, 41, -1, -1, 44, 45, -1, -1, -1, 3, -1, 5, 52, 7, -1, -1, -1, 11, -1, -1, 60, 15, 16, -1, -1, -1, 20, -1, -1, 23, 24, -1, 26, -1, -1, -1, 76, -1, 32, 33, 34, -1, -1, -1, 38, -1, -1, 41, -1, -1, 44, 45, -1, -1, -1, 3, -1, 5, 52, 7, -1, -1, -1, 11, -1, -1, 60, 15, 16, -1, -1, -1, 20, -1, -1, 23, 24, -1, 26, -1, -1, -1, 76, -1, 32, 33, 34, -1, -1, -1, 38, -1, -1, 41, -1, 43, 44, 45, -1, -1, -1, 3, -1, 5, 52, 7, -1, -1, -1, 11, -1, -1, -1, 15, 16, -1, -1, -1, 20, -1, -1, 23, 24, 14, 26, -1, -1, -1, 76, -1, 32, 33, 34, -1, -1, 26, 38, -1, -1, 41, -1, -1, 44, 45, -1, -1, 37, -1, -1, -1, 52, -1, -1, -1, -1, 46, 47, -1, -1, -1, -1, 52, 53, 54, 55, -1, -1, -1, 3, -1, 5, 62, 7, -1, 76, -1, 11, 68, 69, -1, 15, 16, 73, -1, -1, 20, -1, -1, 23, 24, 5, 26, 7, -1, -1, -1, 11, 32, 33, 34, 15, 16, -1, 38, -1, 20, 41, -1, -1, 44, 45, 26, -1, -1, -1, -1, -1, 52, 33, 34, -1, -1, -1, -1, -1, -1, 41, -1, -1, 44, 45, -1, -1, -1, -1, -1, -1, 52 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/local/share/bison/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. */ /* 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. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) /* The parser invokes alloca or malloc; define the necessary symbols. */ # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # else # ifndef YYSTACK_USE_ALLOCA # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif # define YYSTACK_ALLOC malloc # define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short yyss; YYSTYPE yyvs; # if YYLSP_NEEDED YYLTYPE yyls; # endif }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # if YYLSP_NEEDED # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAX) # else # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAX) # endif /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #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 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). When YYLLOC_DEFAULT is run, CURRENT is set the location of the first token. By default, to implement support for ranges, extend its range to the last symbol. */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ Current.last_line = Rhs[N].last_line; \ Current.last_column = Rhs[N].last_column; #endif /* YYLEX -- calling `yylex' with the right arguments. */ #if YYPURE # if YYLSP_NEEDED # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # else # define YYLEX yylex (&yylval, &yylloc) # endif # else /* !YYLSP_NEEDED */ # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) # else # define YYLEX yylex (&yylval) # endif # endif /* !YYLSP_NEEDED */ #else /* !YYPURE */ # define YYLEX yylex () #endif /* !YYPURE */ /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #ifdef YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { register const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # endif # endif # ifndef yystpcpy # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { register char *yyd = yydest; register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif #endif #line 315 "/usr/local/share/bison/bison.simple" /* 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 # if defined (__STDC__) || defined (__cplusplus) # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM # define YYPARSE_PARAM_DECL # else # define YYPARSE_PARAM_ARG YYPARSE_PARAM # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; # endif #else /* !YYPARSE_PARAM */ # define YYPARSE_PARAM_ARG # define YYPARSE_PARAM_DECL #endif /* !YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ # ifdef YYPARSE_PARAM int yyparse (void *); # else int yyparse (void); # endif #endif /* YY_DECL_VARIABLES -- depending whether we use a pure parser, variables are global, or local to YYPARSE. */ #define YY_DECL_NON_LSP_VARIABLES \ /* The lookahead symbol. */ \ int yychar; \ \ /* The semantic value of the lookahead symbol. */ \ YYSTYPE yylval; \ \ /* Number of parse errors so far. */ \ int yynerrs; #if YYLSP_NEEDED # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES \ \ /* Location data for the lookahead symbol. */ \ YYLTYPE yylloc; #else # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES #endif /* If nonreentrant, generate the variables here. */ #if !YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { /* If reentrant, generate the variables here. */ #if YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yychar1 = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #if YYLSP_NEEDED /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #endif #if YYLSP_NEEDED # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else # define YYPOPSTACK (yyvsp--, yyssp--) #endif YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYLSP_NEEDED YYLTYPE yyloc; #endif /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); 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; yyvsp = yyvs; #if YYLSP_NEEDED yylsp = yyls; #endif goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* 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; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ # if YYLSP_NEEDED YYLTYPE *yyls1 = yyls; /* 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, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; # else yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); # endif yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) goto yyoverflowlab; yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # if YYLSP_NEEDED YYSTACK_RELOCATE (yyls); # endif # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; #if YYLSP_NEEDED yylsp = yyls + yysize - 1; #endif YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | 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) { YYDPRINTF ((stderr, "Reading a token: ")); 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 */ YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yychar1 = YYTRANSLATE (yychar); #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { YYFPRINTF (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 YYFPRINTF (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. */ YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to the semantic value of the lookahead token. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; #if YYLSP_NEEDED /* Similarly for the default location. Let the user run additional commands if for instance locations are ranges. */ yyloc = yylsp[1-yylen]; YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); #endif #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { int yyi; YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 1: #line 299 "./parser.y" { yyerror ("Empty file"); YYABORT; } break; case 2: #line 300 "./parser.y" { __IDL_root = yyvsp[0].tree; } break; case 3: #line 303 "./parser.y" { yyval.tree = NULL; } break; case 5: #line 307 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 6: #line 308 "./parser.y" { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); } break; case 8: #line 312 "./parser.y" { if (do_token_error (yyvsp[0].tree, "Missing semicolon after", TRUE)) YYABORT; } break; case 9: #line 318 "./parser.y" { yyerror ("Dangling semicolon has no effect"); yyval.tree = NULL; } break; case 11: #line 325 "./parser.y" { if (do_token_error (yyvsp[0].tree, "Missing comma after", TRUE)) YYABORT; } break; case 12: #line 331 "./parser.y" { if (IDL_NODE_UP (yyvsp[0].tree)) do_token_error (IDL_NODE_UP (yyvsp[0].tree), "Illegal context for", FALSE); else yyerror ("Illegal context for identifier"); YYABORT; } break; case 22: #line 354 "./parser.y" { if (IDL_NODE_UP (yyvsp[0].tree) != NULL && IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_MODULE) { yyerror ("Module definition conflicts"); do_token_error (IDL_NODE_UP (yyvsp[0].tree), "with", FALSE); YYABORT; } } break; case 23: #line 363 "./parser.y" { IDL_tree module; if (yyvsp[-2].tree == NULL) { yyerrorv ("Empty module declaration `%s' is not legal IDL", IDL_IDENT (yyvsp[-5].tree).str); module = NULL; } if (__IDL_flags & IDLF_COMBINE_REOPENED_MODULES) { if (IDL_NODE_UP (yyvsp[-5].tree) == NULL) module = IDL_module_new (yyvsp[-5].tree, yyvsp[-2].tree); else { module = IDL_NODE_UP (yyvsp[-5].tree); IDL_MODULE (module).definition_list = IDL_list_concat (IDL_MODULE (module).definition_list, yyvsp[-2].tree); module = NULL; } } else module = IDL_module_new (yyvsp[-5].tree, yyvsp[-2].tree); yyval.tree = module; if (yyval.tree) assign_declspec (yyval.tree, yyvsp[-6].declspec); } break; case 25: #line 390 "./parser.y" { yyerror ("Interfaces cannot be named `Object'"); YYABORT; } break; case 26: #line 394 "./parser.y" { yyerror ("Interfaces cannot be named `TypeCode'"); YYABORT; } break; case 27: #line 403 "./parser.y" { assert (yyvsp[0].tree != NULL); assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT); assert (IDL_IDENT_TO_NS (yyvsp[0].tree) != NULL); assert (IDL_NODE_TYPE (IDL_IDENT_TO_NS (yyvsp[0].tree)) == IDLN_GENTREE); if (IDL_NODE_UP (yyvsp[0].tree) != NULL && IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_INTERFACE && IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_FORWARD_DCL) { yyerrorl ("Interface definition conflicts", __IDL_prev_token_line - __IDL_cur_token_line); do_token_error (IDL_NODE_UP (yyvsp[0].tree), "with", FALSE); YYABORT; } else if (IDL_NODE_UP (yyvsp[0].tree) != NULL && IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_FORWARD_DCL) { yyerrorv ("Cannot redeclare interface `%s'", IDL_IDENT (yyvsp[0].tree).str); IDL_tree_error (yyvsp[0].tree, "Previous declaration of interface `%s'", IDL_IDENT (yyvsp[0].tree).str); YYABORT; } else if (IDL_NODE_UP (yyvsp[0].tree) != NULL && IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) == IDLN_FORWARD_DCL) __IDL_assign_this_location (yyvsp[0].tree, __IDL_cur_filename, __IDL_cur_line); } break; case 28: #line 426 "./parser.y" { IDL_GENTREE (IDL_IDENT_TO_NS (yyvsp[-3].tree))._import = yyvsp[0].tree; IDL_ns_push_scope (__IDL_root_ns, IDL_IDENT_TO_NS (yyvsp[-3].tree)); if (IDL_ns_check_for_ambiguous_inheritance (yyvsp[-3].tree, yyvsp[0].tree)) __IDL_is_okay = FALSE; } break; case 29: #line 433 "./parser.y" { yyval.tree = IDL_interface_new (yyvsp[-8].tree, yyvsp[-5].tree, yyvsp[-2].tree); assign_declspec (yyval.tree, yyvsp[-11].declspec); assign_props (IDL_INTERFACE (yyval.tree).ident, yyvsp[-10].hash_table); } break; case 30: #line 442 "./parser.y" { if (yyvsp[-3].hash_table) yywarningv (IDL_WARNING1, "Ignoring properties for forward declaration `%s'", IDL_IDENT (yyvsp[-1].tree).str); yyval.tree = IDL_forward_dcl_new (yyvsp[-1].tree); assign_declspec (yyval.tree, yyvsp[-4].declspec); } break; case 31: #line 451 "./parser.y" { yyval.tree = NULL; } break; case 32: #line 452 "./parser.y" { GHashTable *table = g_hash_table_new (g_direct_hash, g_direct_equal); gboolean die = FALSE; IDL_tree p = yyvsp[0].tree; assert (IDL_NODE_TYPE (p) == IDLN_LIST); for (; p != NULL && !die; p = IDL_LIST (p).next) { assert (IDL_LIST (p).data != NULL); assert (IDL_NODE_TYPE (IDL_LIST (p).data) == IDLN_IDENT); if (g_hash_table_lookup_extended (table, IDL_LIST (p).data, NULL, NULL)) { char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0); yyerrorv ("Cannot inherit from interface `%s' more than once", s); g_free (s); die = TRUE; break; } else g_hash_table_insert (table, IDL_LIST (p).data, NULL); if (IDL_NODE_TYPE (IDL_NODE_UP (IDL_LIST (p).data)) == IDLN_FORWARD_DCL) { char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0); yyerrorv ("Incomplete definition of interface `%s'", s); IDL_tree_error (IDL_LIST (p).data, "Previous forward declaration of `%s'", s); g_free (s); die = TRUE; } else if (IDL_NODE_TYPE (IDL_NODE_UP (IDL_LIST (p).data)) != IDLN_INTERFACE) { char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0); yyerrorv ("`%s' is not an interface", s); IDL_tree_error (IDL_LIST (p).data, "Previous declaration of `%s'", s); g_free (s); die = TRUE; } } g_hash_table_destroy (table); if (die) YYABORT; yyval.tree = yyvsp[0].tree; } break; case 33: #line 498 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 34: #line 500 "./parser.y" { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); } break; case 36: #line 506 "./parser.y" { yyval.tree = NULL; } break; case 37: #line 507 "./parser.y" { yyval.tree = zlist_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); } break; case 45: #line 519 "./parser.y" { yyval.tree = yyvsp[0].tree; assign_declspec (yyval.tree, yyvsp[-1].declspec); } break; case 46: #line 526 "./parser.y" { IDL_tree_node node; IDL_tree p, dcl; yyval.tree = yyvsp[0].tree; node.properties = yyvsp[-2].hash_table; for (p = IDL_TYPE_DCL (yyvsp[0].tree).dcls; p; p = IDL_LIST (p).next) { dcl = IDL_LIST (p).data; IDL_tree_properties_copy (&node, dcl); } __IDL_free_properties (node.properties); } break; case 50: #line 542 "./parser.y" { yyval.tree = IDL_native_new (yyvsp[0].tree); assign_props (IDL_NATIVE (yyval.tree).ident, yyvsp[-2].hash_table); } break; case 51: #line 547 "./parser.y" { /* Enable native type scanning */ if (__IDL_flags & IDLF_XPIDL) __IDL_flagsi |= IDLFP_NATIVE; else { yyerror ("Native syntax not enabled"); YYABORT; } } break; case 52: #line 555 "./parser.y" { yyval.tree = IDL_native_new (yyvsp[-3].tree); IDL_NATIVE (yyval.tree).user_type = yyvsp[0].str; assign_props (IDL_NATIVE (yyval.tree).ident, yyvsp[-5].hash_table); } break; case 53: #line 562 "./parser.y" { yyval.tree = IDL_type_dcl_new (yyvsp[-1].tree, yyvsp[0].tree); } break; case 62: #line 579 "./parser.y" { yyerrorv ("Missing identifier in %s definition", yyvsp[0].str); YYABORT; } break; case 64: #line 586 "./parser.y" { yyerrorv ("Missing identifier in %s definition", yyvsp[0].str); YYABORT; } break; case 66: #line 594 "./parser.y" { yyval.str = "struct"; } break; case 67: #line 595 "./parser.y" { g_hash_table_insert (__IDL_structunion_ht, yyvsp[-1].tree, yyvsp[-1].tree); yyval.tree = IDL_type_struct_new (yyvsp[-1].tree, NULL); } break; case 68: #line 599 "./parser.y" { g_hash_table_remove (__IDL_structunion_ht, yyvsp[-5].tree); yyval.tree = yyvsp[-3].tree; __IDL_assign_up_node (yyval.tree, yyvsp[-2].tree); IDL_TYPE_STRUCT (yyval.tree).member_list = yyvsp[-2].tree; assign_props (IDL_TYPE_STRUCT (yyval.tree).ident, yyvsp[-8].hash_table); } break; case 69: #line 609 "./parser.y" { yyval.str = "union"; } break; case 70: #line 612 "./parser.y" { g_hash_table_insert (__IDL_structunion_ht, yyvsp[-5].tree, yyvsp[-5].tree); yyval.tree = IDL_type_union_new (yyvsp[-5].tree, yyvsp[-2].tree, NULL); } break; case 71: #line 616 "./parser.y" { g_hash_table_remove (__IDL_structunion_ht, yyvsp[-9].tree); yyval.tree = yyvsp[-3].tree; __IDL_assign_up_node (yyval.tree, yyvsp[-2].tree); IDL_TYPE_UNION (yyval.tree).switch_body = yyvsp[-2].tree; assign_props (IDL_TYPE_UNION (yyval.tree).ident, yyvsp[-12].hash_table); } break; case 78: #line 635 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 79: #line 636 "./parser.y" { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); } break; case 80: #line 640 "./parser.y" { yyval.tree = IDL_case_stmt_new (yyvsp[-2].tree, yyvsp[-1].tree); } break; case 81: #line 643 "./parser.y" { char *s; yyval.tree = IDL_member_new (yyvsp[-1].tree, list_start (yyvsp[0].tree, TRUE)); if (IDL_NODE_TYPE (yyvsp[-1].tree) == IDLN_IDENT && g_hash_table_lookup (__IDL_structunion_ht, yyvsp[-1].tree)) { s = IDL_ns_ident_to_qstring (yyvsp[0].tree, "::", 0); yyerrorv ("Member `%s'", s); do_token_error (IDL_NODE_UP (yyvsp[-1].tree), "recurses", TRUE); g_free (s); } } break; case 82: #line 657 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, FALSE); } break; case 83: #line 658 "./parser.y" { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, FALSE); } break; case 84: #line 661 "./parser.y" { yyval.tree = yyvsp[-1].tree; } break; case 85: #line 662 "./parser.y" { yyval.tree = NULL; } break; case 86: #line 665 "./parser.y" { yyval.tree = yyvsp[0].tree; assign_declspec (yyval.tree, yyvsp[-1].declspec); } break; case 87: #line 672 "./parser.y" { yyval.tree = IDL_const_dcl_new (yyvsp[-3].tree, yyvsp[-2].tree, yyvsp[0].tree); /* Should probably do some type checking here... */ } break; case 88: #line 678 "./parser.y" { yyval.tree = yyvsp[0].tree; assign_declspec (yyval.tree, yyvsp[-1].declspec); } break; case 89: #line 686 "./parser.y" { yyval.tree = IDL_except_dcl_new (yyvsp[-4].tree, yyvsp[-2].tree); } break; case 90: #line 689 "./parser.y" { yyval.tree = NULL; } break; case 91: #line 690 "./parser.y" { yyval.tree = zlist_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); } break; case 92: #line 693 "./parser.y" { yyval.boolean = FALSE; } break; case 93: #line 694 "./parser.y" { yyval.boolean = TRUE; } break; case 94: #line 697 "./parser.y" { yyval.tree = yyvsp[0].tree; assign_declspec (yyval.tree, yyvsp[-1].declspec); } break; case 95: #line 706 "./parser.y" { yyval.str = "attribute"; } break; case 96: #line 708 "./parser.y" { IDL_tree_node node; IDL_tree p, dcl; yyval.tree = IDL_attr_dcl_new (yyvsp[-4].boolean, yyvsp[-1].tree, yyvsp[0].tree); node.properties = yyvsp[-5].hash_table; for (p = yyvsp[0].tree; p; p = IDL_LIST (p).next) { dcl = IDL_LIST (p).data; IDL_tree_properties_copy (&node, dcl); } __IDL_free_properties (node.properties); } break; case 98: #line 723 "./parser.y" { yyerrorv ("Illegal type `void' for %s", yyvsp[-1].str); yyval.tree = NULL; } break; case 106: #line 739 "./parser.y" { illegal_context_type_error (yyvsp[0].tree, yyvsp[-1].str); yyval.tree = yyvsp[0].tree; } break; case 107: #line 745 "./parser.y" { yyval.boolean = FALSE; } break; case 108: #line 746 "./parser.y" { yyval.boolean = TRUE; } break; case 109: #line 749 "./parser.y" { yyval.tree = yyvsp[0].tree; assign_declspec (yyval.tree, yyvsp[-1].declspec); } break; case 110: #line 760 "./parser.y" { yyval.tree = IDL_op_dcl_new (yyvsp[-6].boolean, yyvsp[-5].tree, yyvsp[-4].tree, yyvsp[-3].treedata.tree, yyvsp[-1].tree, yyvsp[0].tree); IDL_OP_DCL (yyval.tree).f_varargs = GPOINTER_TO_INT (yyvsp[-3].treedata.data); assign_props (IDL_OP_DCL (yyval.tree).ident, yyvsp[-7].hash_table); } break; case 111: #line 767 "./parser.y" { yyval.str = "operation return value"; } break; case 112: #line 768 "./parser.y" { yyval.tree = yyvsp[0].tree; } break; case 113: #line 769 "./parser.y" { yyval.tree = NULL; } break; case 114: #line 772 "./parser.y" { yyval.boolean = FALSE; } break; case 115: #line 773 "./parser.y" { yyval.boolean = TRUE; } break; case 116: #line 776 "./parser.y" { yyval.boolean = FALSE; } break; case 117: #line 777 "./parser.y" { yyval.boolean = TRUE; } break; case 118: #line 783 "./parser.y" { yyval.treedata.tree = yyvsp[-2].tree; yyval.treedata.data = GINT_TO_POINTER (yyvsp[-1].boolean); } break; case 119: #line 787 "./parser.y" { yyval.treedata.tree = NULL; yyval.treedata.data = GINT_TO_POINTER (yyvsp[-1].boolean); } break; case 120: #line 793 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 121: #line 795 "./parser.y" { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); } break; case 122: #line 800 "./parser.y" { yyval.str = "parameter"; } break; case 123: #line 802 "./parser.y" { yyval.tree = IDL_param_dcl_new (yyvsp[-3].paramattr, yyvsp[-1].tree, yyvsp[0].tree); assign_props (IDL_PARAM_DCL (yyval.tree).simple_declarator, yyvsp[-4].hash_table); } break; case 124: #line 808 "./parser.y" { yyval.paramattr = IDL_PARAM_IN; } break; case 125: #line 809 "./parser.y" { yyval.paramattr = IDL_PARAM_OUT; } break; case 126: #line 810 "./parser.y" { yyval.paramattr = IDL_PARAM_INOUT; } break; case 127: #line 811 "./parser.y" { yyerrorv ("Missing direction attribute (in, out, inout) before parameter"); IDL_tree_free (yyvsp[0].tree); } break; case 128: #line 817 "./parser.y" { yyval.tree = NULL; } break; case 130: #line 821 "./parser.y" { yyval.tree = NULL; } break; case 132: #line 827 "./parser.y" { yyval.tree = yyvsp[-1].tree; } break; case 133: #line 832 "./parser.y" { yyval.tree = yyvsp[-1].tree; } break; case 145: #line 850 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_OR, yyvsp[-2].tree, yyvsp[0].tree); } break; case 147: #line 854 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_XOR, yyvsp[-2].tree, yyvsp[0].tree); } break; case 149: #line 858 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_AND, yyvsp[-2].tree, yyvsp[0].tree); } break; case 151: #line 862 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_SHR, yyvsp[-2].tree, yyvsp[0].tree); } break; case 152: #line 863 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_SHL, yyvsp[-2].tree, yyvsp[0].tree); } break; case 154: #line 867 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_ADD, yyvsp[-2].tree, yyvsp[0].tree); } break; case 155: #line 868 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_SUB, yyvsp[-2].tree, yyvsp[0].tree); } break; case 157: #line 872 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_MULT, yyvsp[-2].tree, yyvsp[0].tree); } break; case 158: #line 873 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_DIV, yyvsp[-2].tree, yyvsp[0].tree); } break; case 159: #line 874 "./parser.y" { do_binop (yyval.tree, IDL_BINOP_MOD, yyvsp[-2].tree, yyvsp[0].tree); } break; case 160: #line 877 "./parser.y" { do_unaryop (yyval.tree, yyvsp[-1].unaryop, yyvsp[0].tree); } break; case 162: #line 881 "./parser.y" { yyval.unaryop = IDL_UNARYOP_MINUS; } break; case 163: #line 882 "./parser.y" { yyval.unaryop = IDL_UNARYOP_PLUS; } break; case 164: #line 883 "./parser.y" { yyval.unaryop = IDL_UNARYOP_COMPLEMENT; } break; case 165: #line 886 "./parser.y" { IDL_tree p, literal; assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT); p = IDL_NODE_UP (yyvsp[0].tree); if ((literal = IDL_resolve_const_exp (yyvsp[0].tree, IDLN_ANY))) { ++IDL_NODE_REFS (literal); yyval.tree = literal; IDL_tree_free (yyvsp[0].tree); } else yyval.tree = yyvsp[0].tree; } break; case 167: #line 901 "./parser.y" { yyval.tree = yyvsp[-1].tree; } break; case 174: #line 913 "./parser.y" { yyval.str = "enum"; } break; case 175: #line 916 "./parser.y" { yyval.tree = IDL_type_enum_new (yyvsp[-3].tree, yyvsp[-1].tree); assign_props (IDL_TYPE_ENUM (yyval.tree).ident, yyvsp[-6].hash_table); } break; case 176: #line 922 "./parser.y" { assert (yyvsp[0].tree != NULL); assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_GENTREE); assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT); yyval.tree = IDL_GENTREE (yyvsp[0].tree).data; } break; case 178: #line 931 "./parser.y" { yyval.tree = yyvsp[0].tree; } break; case 179: #line 933 "./parser.y" { IDL_tree p; assert (IDL_NODE_TYPE (yyvsp[-2].tree) == IDLN_GENTREE); assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT); #ifdef YYDEBUG if (yydebug) printf ("looking in %s\n", IDL_IDENT (IDL_GENTREE (yyvsp[-2].tree).data).str); #endif if ((p = IDL_ns_lookup_this_scope (__IDL_root_ns, yyvsp[-2].tree, yyvsp[0].tree, NULL)) == NULL) { #ifdef YYDEBUG if (yydebug) printf ("'%s'\n", IDL_IDENT (yyvsp[0].tree).str); #endif yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str); IDL_tree_free (yyvsp[0].tree); YYABORT; } IDL_tree_free (yyvsp[0].tree); #ifdef REF_IDENTS ++IDL_NODE_REFS (IDL_GENTREE (p).data); #endif yyval.tree = p; } break; case 180: #line 961 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 181: #line 963 "./parser.y" { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); } break; case 182: #line 966 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 183: #line 967 "./parser.y" { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); } break; case 184: #line 971 "./parser.y" { char *s; yyval.tree = IDL_member_new (yyvsp[-2].tree, yyvsp[-1].tree); if (IDL_NODE_TYPE (yyvsp[-2].tree) == IDLN_IDENT && g_hash_table_lookup (__IDL_structunion_ht, yyvsp[-2].tree)) { s = IDL_ns_ident_to_qstring (IDL_LIST (yyvsp[-1].tree).data, "::", 0); yyerrorv ("Member `%s'", s); do_token_error (IDL_NODE_UP (yyvsp[-2].tree), "recurses", TRUE); g_free (s); } } break; case 198: #line 1004 "./parser.y" { yyval.tree = IDL_type_sequence_new (yyvsp[-3].tree, yyvsp[-1].tree); } break; case 199: #line 1007 "./parser.y" { yyval.tree = IDL_type_sequence_new (yyvsp[-1].tree, NULL); } break; case 200: #line 1010 "./parser.y" { yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_FLOAT); } break; case 201: #line 1011 "./parser.y" { yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_DOUBLE); } break; case 202: #line 1012 "./parser.y" { yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_LONGDOUBLE); } break; case 203: #line 1017 "./parser.y" { yyval.tree = IDL_type_fixed_new (yyvsp[-3].tree, yyvsp[-1].tree); } break; case 204: #line 1020 "./parser.y" { yyval.tree = IDL_type_fixed_new (NULL, NULL); } break; case 205: #line 1023 "./parser.y" { yyval.tree = IDL_type_integer_new (TRUE, yyvsp[0].integer); } break; case 206: #line 1024 "./parser.y" { yyval.tree = IDL_type_integer_new (FALSE, yyvsp[0].integer); } break; case 207: #line 1027 "./parser.y" { yyval.integer = IDL_INTEGER_TYPE_SHORT; } break; case 208: #line 1028 "./parser.y" { yyval.integer = IDL_INTEGER_TYPE_LONG; } break; case 209: #line 1029 "./parser.y" { yyval.integer = IDL_INTEGER_TYPE_LONGLONG; } break; case 213: #line 1041 "./parser.y" { yyval.integer = IDL_INTEGER_TYPE_SHORT; } break; case 214: #line 1042 "./parser.y" { yyval.integer = IDL_INTEGER_TYPE_LONG; } break; case 215: #line 1043 "./parser.y" { yyval.integer = IDL_INTEGER_TYPE_LONGLONG; } break; case 219: #line 1055 "./parser.y" { yyval.tree = IDL_type_char_new (); } break; case 220: #line 1058 "./parser.y" { yyval.tree = IDL_type_wide_char_new (); } break; case 221: #line 1061 "./parser.y" { yyval.tree = IDL_type_boolean_new (); } break; case 222: #line 1064 "./parser.y" { yyval.tree = IDL_type_octet_new (); } break; case 223: #line 1067 "./parser.y" { yyval.tree = IDL_type_any_new (); } break; case 224: #line 1070 "./parser.y" { yyval.tree = IDL_type_object_new (); } break; case 225: #line 1073 "./parser.y" { yyval.tree = IDL_type_typecode_new (); } break; case 226: #line 1078 "./parser.y" { yyval.tree = IDL_type_string_new (yyvsp[-1].tree); } break; case 227: #line 1079 "./parser.y" { yyval.tree = IDL_type_string_new (NULL); } break; case 228: #line 1084 "./parser.y" { yyval.tree = IDL_type_wide_string_new (yyvsp[-1].tree); } break; case 229: #line 1085 "./parser.y" { yyval.tree = IDL_type_wide_string_new (NULL); } break; case 230: #line 1088 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 231: #line 1090 "./parser.y" { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); } break; case 236: #line 1103 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 237: #line 1105 "./parser.y" { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); } break; case 238: #line 1109 "./parser.y" { IDL_tree p; int i; yyval.tree = IDL_type_array_new (yyvsp[-1].tree, yyvsp[0].tree); for (i = 1, p = yyvsp[0].tree; p; ++i, p = IDL_LIST (p).next) if (!IDL_LIST (p).data) { char *s = IDL_ns_ident_to_qstring (yyvsp[-1].tree, "::", 0); yyerrorv ("Missing value in dimension %d of array `%s'", i, s); g_free (s); } } break; case 239: #line 1123 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, FALSE); } break; case 240: #line 1125 "./parser.y" { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, FALSE); } break; case 241: #line 1128 "./parser.y" { yyval.tree = yyvsp[-1].tree; } break; case 242: #line 1129 "./parser.y" { yyval.tree = NULL; } break; case 243: #line 1133 "./parser.y" { yyval.hash_table = g_hash_table_new (IDL_strcase_hash, IDL_strcase_equal); g_hash_table_insert (yyval.hash_table, yyvsp[-1].str, yyvsp[0].str); } break; case 244: #line 1139 "./parser.y" { yyval.hash_table = yyvsp[-3].hash_table; g_hash_table_insert (yyval.hash_table, yyvsp[-1].str, yyvsp[0].str); } break; case 245: #line 1143 "./parser.y" { yyval.hash_table = g_hash_table_new (IDL_strcase_hash, IDL_strcase_equal); g_hash_table_insert (yyval.hash_table, yyvsp[0].str, g_strdup ("")); } break; case 246: #line 1148 "./parser.y" { yyval.hash_table = yyvsp[-2].hash_table; g_hash_table_insert (yyval.hash_table, yyvsp[0].str, g_strdup ("")); } break; case 247: #line 1154 "./parser.y" { yyval.tree = IDL_ident_new (yyvsp[0].str); } break; case 248: #line 1157 "./parser.y" { assert (yyvsp[0].tree != NULL); assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_GENTREE); assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT); yyval.tree = IDL_GENTREE (yyvsp[0].tree).data; } break; case 249: #line 1165 "./parser.y" { IDL_ns_push_scope (__IDL_root_ns, yyvsp[0].tree); #ifdef YYDEBUG if (yydebug) printf ("entering new/prev scope of %s\n", IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str); #endif assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT); yyval.tree = IDL_GENTREE (yyvsp[0].tree).data; } break; case 250: #line 1177 "./parser.y" { IDL_ns_push_scope (__IDL_root_ns, yyvsp[0].tree); assert (IDL_NS (__IDL_root_ns).current != NULL); assert (IDL_NODE_TYPE (IDL_NS (__IDL_root_ns).current) == IDLN_GENTREE); assert (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data != NULL); assert (IDL_NODE_TYPE (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data) == IDLN_IDENT); #ifdef YYDEBUG if (yydebug) printf ("entering new/prev scope of %s\n", IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str); #endif assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT); yyval.tree = IDL_GENTREE (yyvsp[0].tree).data; } break; case 251: #line 1193 "./parser.y" { #ifdef YYDEBUG if (yydebug) printf ("scope to parent of %s\n", IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str); #endif IDL_ns_pop_scope (__IDL_root_ns); } break; case 252: #line 1203 "./parser.y" { IDL_tree p; if ((p = IDL_ns_place_new (__IDL_root_ns, yyvsp[0].tree)) == NULL) { IDL_tree q; int i; p = IDL_ns_lookup_cur_scope (__IDL_root_ns, yyvsp[0].tree, NULL); for (i = 0, q = IDL_GENTREE (p).data; q && (IDL_NODE_TYPE (q) == IDLN_IDENT || IDL_NODE_TYPE (q) == IDLN_LIST) && i < 4; ++i) if (IDL_NODE_UP (q)) q = IDL_NODE_UP (q); if (q) { IDL_tree_error (yyvsp[0].tree, "`%s' conflicts", IDL_IDENT (yyvsp[0].tree).str); do_token_error (q, "with", FALSE); } else yyerrorv ("`%s' duplicate identifier", IDL_IDENT (yyvsp[0].tree).str); IDL_tree_free (yyvsp[0].tree); YYABORT; } assert (IDL_IDENT (yyvsp[0].tree)._ns_ref == p); #ifdef REF_IDENTS ++IDL_NODE_REFS (IDL_GENTREE (p).data); #endif if (__IDL_new_ident_comments != NULL) { assert (IDL_IDENT (yyvsp[0].tree).comments == NULL); IDL_IDENT (yyvsp[0].tree).comments = __IDL_new_ident_comments; __IDL_new_ident_comments = NULL; } yyval.tree = p; } break; case 253: #line 1241 "./parser.y" { IDL_tree p; if ((p = IDL_ns_resolve_ident (__IDL_root_ns, yyvsp[0].tree)) == NULL) { yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str); IDL_tree_free (yyvsp[0].tree); YYABORT; } IDL_tree_free (yyvsp[0].tree); assert (IDL_GENTREE (p).data != NULL); assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p); #ifdef REF_IDENTS ++IDL_NODE_REFS (IDL_GENTREE (p).data); #endif yyval.tree = p; } break; case 254: #line 1260 "./parser.y" { IDL_tree p; if ((p = IDL_ns_lookup_cur_scope (__IDL_root_ns, yyvsp[0].tree, NULL)) == NULL) { p = IDL_ns_place_new (__IDL_root_ns, yyvsp[0].tree); assert (p != NULL); assert (IDL_IDENT (yyvsp[0].tree)._ns_ref == p); if (__IDL_new_ident_comments != NULL) { assert (IDL_IDENT (yyvsp[0].tree).comments == NULL); IDL_IDENT (yyvsp[0].tree).comments = __IDL_new_ident_comments; __IDL_new_ident_comments = NULL; } } else { IDL_tree_free (yyvsp[0].tree); assert (IDL_GENTREE (p).data != NULL); assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p); } #ifdef REF_IDENTS ++IDL_NODE_REFS (IDL_GENTREE (p).data); #endif yyval.tree = p; } break; case 255: #line 1284 "./parser.y" { IDL_tree p; if ((p = IDL_ns_lookup_this_scope ( __IDL_root_ns,IDL_NS (__IDL_root_ns).file, yyvsp[0].tree, NULL)) == NULL) { yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str); IDL_tree_free (yyvsp[0].tree); YYABORT; } IDL_tree_free (yyvsp[0].tree); assert (IDL_GENTREE (p).data != NULL); assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p); #ifdef REF_IDENTS ++IDL_NODE_REFS (IDL_GENTREE (p).data); #endif yyval.tree = p; } break; case 256: #line 1303 "./parser.y" { yyval.tree = list_start (yyvsp[0].tree, TRUE); } break; case 257: #line 1305 "./parser.y" { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); } break; case 258: #line 1308 "./parser.y" { IDL_tree literal, ident = NULL; IDL_longlong_t value = 0; if ((literal = IDL_resolve_const_exp (yyvsp[0].tree, IDLN_INTEGER))) { assert (IDL_NODE_TYPE (literal) == IDLN_INTEGER); ++IDL_NODE_REFS (literal); value = IDL_INTEGER (literal).value; IDL_tree_free (yyvsp[0].tree); } if (literal && IDL_NODE_UP (literal) && IDL_NODE_TYPE (IDL_NODE_UP (literal)) == IDLN_CONST_DCL) ident = IDL_CONST_DCL (IDL_NODE_UP (literal)).ident; if (literal == NULL) { if (!(__IDL_flags & IDLF_NO_EVAL_CONST)) yyerror ("Could not resolve constant expression"); yyval.tree = yyvsp[0].tree; } else if (value == 0) { yyerror ("Zero array size is illegal"); if (ident) IDL_tree_error (ident, "From constant declared here"); yyval.tree = NULL; } else if (value < 0) { yywarningv (IDL_WARNING1, "Cannot use negative value %" IDL_LL "d, using %" IDL_LL "d", value, -value); if (ident) IDL_tree_warning (ident, IDL_WARNING1, "From constant declared here"); yyval.tree = IDL_integer_new (-value); } else yyval.tree = IDL_integer_new (value); } break; case 259: #line 1346 "./parser.y" { yyval.declspec = 0; } break; case 260: #line 1347 "./parser.y" { yyval.declspec = IDL_parse_declspec (yyvsp[0].str); g_free (yyvsp[0].str); } break; case 261: #line 1353 "./parser.y" { yyval.hash_table = NULL; } break; case 262: #line 1354 "./parser.y" { /* Enable property scanning */ if (__IDL_flags & IDLF_PROPERTIES) __IDL_flagsi |= IDLFP_PROPERTIES; else { yyerror ("Property syntax not enabled"); YYABORT; } } break; case 263: #line 1363 "./parser.y" { yyval.hash_table = yyvsp[-1].hash_table; } break; case 264: #line 1366 "./parser.y" { yyval.tree = IDL_integer_new (yyvsp[0].integer); } break; case 265: #line 1369 "./parser.y" { yyval.tree = IDL_string_new (yyvsp[0].str); } break; case 266: #line 1372 "./parser.y" { yyval.tree = IDL_char_new (yyvsp[0].str); } break; case 267: #line 1375 "./parser.y" { yyval.tree = IDL_fixed_new (yyvsp[0].str); } break; case 268: #line 1378 "./parser.y" { yyval.tree = IDL_float_new (yyvsp[0].floatp); } break; case 269: #line 1381 "./parser.y" { yyval.tree = IDL_boolean_new (TRUE); } break; case 270: #line 1382 "./parser.y" { yyval.tree = IDL_boolean_new (FALSE); } break; case 271: #line 1385 "./parser.y" { yyval.tree = yyvsp[0].tree; assign_declspec (yyval.tree, yyvsp[-1].declspec); } break; case 273: #line 1392 "./parser.y" { char *catstr = g_malloc (strlen (yyvsp[-1].str) + strlen (yyvsp[0].str) + 1); strcpy (catstr, yyvsp[-1].str); g_free (yyvsp[-1].str); strcat (catstr, yyvsp[0].str); g_free (yyvsp[0].str); yyval.str = catstr; } break; case 274: #line 1400 "./parser.y" { char *s = IDL_do_escapes (yyvsp[0].str); g_free (yyvsp[0].str); yyval.str = s; } break; case 275: #line 1407 "./parser.y" { char *s = IDL_do_escapes (yyvsp[0].str); g_free (yyvsp[0].str); yyval.str = s; } break; } #line 705 "/usr/local/share/bison/bison.simple" yyvsp -= yylen; yyssp -= yylen; #if YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif *++yyvsp = yyval; #if YYLSP_NEEDED *++yylsp = yyloc; #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 | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { YYSIZE_T yysize = 0; char *yymsg; int yyx, yycount; yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) yysize += yystrlen (yytname[yyx]) + 15, yycount++; yysize += yystrlen ("parse error, unexpected ") + 1; yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "parse error, unexpected "); yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); if (yycount < 5) { yycount = 0; for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) { const char *yyq = ! yycount ? ", expecting " : " or "; yyp = yystpcpy (yyp, yyq); yyp = yystpcpy (yyp, yytname[yyx]); yycount++; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("parse error; also virtual memory exhausted"); } else #endif /* defined (YYERROR_VERBOSE) */ yyerror ("parse error"); } goto yyerrlab1; /*--------------------------------------------------. | yyerrlab1 -- error raised explicitly by an action | `--------------------------------------------------*/ yyerrlab1: 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; YYDPRINTF ((stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1])); 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. | `-------------------------------------------------------------------*/ yyerrdefault: #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ /* If its default is to accept any token, ok. Otherwise pop it. */ yyn = yydefact[yystate]; if (yyn) goto yydefault; #endif /*---------------------------------------------------------------. | yyerrpop -- pop the current state because it cannot handle the | | error token | `---------------------------------------------------------------*/ yyerrpop: if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #if YYLSP_NEEDED yylsp--; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "Error: state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif /*--------------. | yyerrhandle. | `--------------*/ 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; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; /*---------------------------------------------. | yyoverflowab -- parser overflow comes here. | `---------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } #line 1414 "./parser.y" void __IDL_parser_reset (void) { yyclearin; } static const char *IDL_ns_get_cur_prefix (IDL_ns ns) { IDL_tree p; p = IDL_NS (ns).current; assert (p != NULL); while (p && !IDL_GENTREE (p)._cur_prefix) p = IDL_NODE_UP (p); return p ? IDL_GENTREE (p)._cur_prefix : NULL; } gchar *IDL_ns_ident_make_repo_id (IDL_ns ns, IDL_tree p, const char *p_prefix, int *major, int *minor) { GString *s = g_string_new (NULL); const char *prefix; char *q; assert (p != NULL); if (IDL_NODE_TYPE (p) == IDLN_IDENT) p = IDL_IDENT_TO_NS (p); assert (p != NULL); prefix = p_prefix ? p_prefix : IDL_ns_get_cur_prefix (ns); q = IDL_ns_ident_to_qstring (p, "/", 0); g_string_sprintf (s, "IDL:%s%s%s:%d.%d", prefix ? prefix : "", prefix && *prefix ? "/" : "", q, major ? *major : 1, minor ? *minor : 0); g_free (q); q = s->str; g_string_free (s, FALSE); return q; } static const char *get_name_token (const char *s, char **tok) { const char *begin = s; int state = 0; if (!s) return NULL; while (isspace (*s)) ++s; while (1) switch (state) { case 0: /* Unknown */ if (*s == ':') state = 1; else if (isalnum (*s) || *s == '_') { begin = s; state = 2; } else return NULL; break; case 1: /* Scope */ if (strncmp (s, "::", 2) == 0) { char *r = g_malloc (3); strcpy (r, "::"); *tok = r; return s + 2; } else /* Invalid */ return NULL; break; case 2: if (isalnum (*s) || *s == '_') ++s; else { char *r = g_malloc (s - begin + 1); strncpy (r, begin, s - begin + 1); r[s - begin] = 0; *tok = r; return s; } break; } } static IDL_tree IDL_ns_pragma_parse_name (IDL_ns ns, const char *s) { IDL_tree p = IDL_NS (ns).current; int start = 1; char *tok; while (p && *s && (s = get_name_token (s, &tok))) { if (tok == NULL) return NULL; if (strcmp (tok, "::") == 0) { if (start) { /* Globally scoped */ p = IDL_NS (ns).file; } g_free (tok); } else { IDL_tree ident = IDL_ident_new (tok); p = IDL_ns_lookup_this_scope (__IDL_root_ns, p, ident, NULL); IDL_tree_free (ident); } start = 0; } return p; } void IDL_ns_ID (IDL_ns ns, const char *s) { char name[1024], id[1024]; IDL_tree p, ident; int n; n = sscanf (s, "%1023s \"%1023s\"", name, id); if (n < 2 && __IDL_is_parsing) { yywarning (IDL_WARNING1, "Malformed pragma ID"); return; } if (id[strlen (id) - 1] == '"') id[strlen (id) - 1] = 0; p = IDL_ns_pragma_parse_name (__IDL_root_ns, name); if (!p && __IDL_is_parsing) { yywarningv (IDL_WARNING1, "Unknown identifier `%s' in pragma ID", name); return; } /* We have resolved the identifier, so assign the repo id */ assert (IDL_NODE_TYPE (p) == IDLN_GENTREE); assert (IDL_GENTREE (p).data != NULL); assert (IDL_NODE_TYPE (IDL_GENTREE (p).data) == IDLN_IDENT); ident = IDL_GENTREE (p).data; if (IDL_IDENT_REPO_ID (ident) != NULL) g_free (IDL_IDENT_REPO_ID (ident)); IDL_IDENT_REPO_ID (ident) = g_strdup (id); } void IDL_ns_version (IDL_ns ns, const char *s) { char name[1024]; int n, major, minor; IDL_tree p, ident; n = sscanf (s, "%1023s %u %u", name, &major, &minor); if (n < 3 && __IDL_is_parsing) { yywarning (IDL_WARNING1, "Malformed pragma version"); return; } p = IDL_ns_pragma_parse_name (__IDL_root_ns, name); if (!p && __IDL_is_parsing) { yywarningv (IDL_WARNING1, "Unknown identifier `%s' in pragma version", name); return; } /* We have resolved the identifier, so assign the repo id */ assert (IDL_NODE_TYPE (p) == IDLN_GENTREE); assert (IDL_GENTREE (p).data != NULL); assert (IDL_NODE_TYPE (IDL_GENTREE (p).data) == IDLN_IDENT); ident = IDL_GENTREE (p).data; if (IDL_IDENT_REPO_ID (ident) != NULL) { char *v = strrchr (IDL_IDENT_REPO_ID (ident), ':'); if (v) { GString *s; *v = 0; s = g_string_new (NULL); g_string_sprintf (s, "%s:%d.%d", IDL_IDENT_REPO_ID (ident), major, minor); g_free (IDL_IDENT_REPO_ID (ident)); IDL_IDENT_REPO_ID (ident) = s->str; g_string_free (s, FALSE); } else if (__IDL_is_parsing) yywarningv (IDL_WARNING1, "Cannot find RepositoryID OMG IDL version in ID `%s'", IDL_IDENT_REPO_ID (ident)); } else IDL_IDENT_REPO_ID (ident) = IDL_ns_ident_make_repo_id ( __IDL_root_ns, p, NULL, &major, &minor); } int IDL_inhibit_get (void) { g_return_val_if_fail (__IDL_is_parsing, -1); return __IDL_inhibits; } void IDL_inhibit_push (void) { g_return_if_fail (__IDL_is_parsing); ++__IDL_inhibits; } void IDL_inhibit_pop (void) { g_return_if_fail (__IDL_is_parsing); if (--__IDL_inhibits < 0) __IDL_inhibits = 0; } static void IDL_inhibit (IDL_ns ns, const char *s) { if (g_strcasecmp ("push", s) == 0) IDL_inhibit_push (); else if (g_strcasecmp ("pop", s) == 0) IDL_inhibit_pop (); } void __IDL_do_pragma (const char *s) { int n; char directive[256]; g_return_if_fail (__IDL_is_parsing); g_return_if_fail (s != NULL); if (sscanf (s, "%255s%n", directive, &n) < 1) return; s += n; while (isspace (*s)) ++s; if (strcmp (directive, "prefix") == 0) IDL_ns_prefix (__IDL_root_ns, s); else if (strcmp (directive, "ID") == 0) IDL_ns_ID (__IDL_root_ns, s); else if (strcmp (directive, "version") == 0) IDL_ns_version (__IDL_root_ns, s); else if (strcmp (directive, "inhibit") == 0) IDL_inhibit (__IDL_root_ns, s); } static IDL_declspec_t IDL_parse_declspec (const char *strspec) { IDL_declspec_t flags = IDLF_DECLSPEC_EXIST; if (strspec == NULL) return flags; if (strcmp (strspec, "inhibit") == 0) flags |= IDLF_DECLSPEC_INHIBIT; else if (__IDL_is_parsing) yywarningv (IDL_WARNING1, "Ignoring unknown declspec `%s'", strspec); return flags; } void IDL_file_set (const char *filename, int line) { IDL_fileinfo *fi; char *orig; g_return_if_fail (__IDL_is_parsing); if (filename) { __IDL_cur_filename = g_strdup (filename); if ( #ifdef HAVE_CPP_PIPE_STDIN !strlen (__IDL_cur_filename) #else __IDL_tmp_filename && !strcmp (__IDL_cur_filename, __IDL_tmp_filename) #endif ) { g_free (__IDL_cur_filename); __IDL_cur_filename = g_strdup (__IDL_real_filename); __IDL_flagsi &= ~IDLFP_IN_INCLUDES; } else __IDL_flagsi |= IDLFP_IN_INCLUDES; if (g_hash_table_lookup_extended (__IDL_filename_hash, __IDL_cur_filename, (gpointer) &orig, (gpointer) &fi)) { g_free (__IDL_cur_filename); __IDL_cur_filename = orig; __IDL_cur_fileinfo = fi; } else { fi = g_new0 (IDL_fileinfo, 1); __IDL_cur_fileinfo = fi; g_hash_table_insert (__IDL_filename_hash, __IDL_cur_filename, fi); } } if (__IDL_cur_line > 0) __IDL_cur_line = line; } void IDL_file_get (const char **filename, int *line) { g_return_if_fail (__IDL_is_parsing); if (filename) *filename = __IDL_cur_filename; if (line) *line = __IDL_cur_line; } static int do_token_error (IDL_tree p, const char *message, gboolean prev) { int dienow; char *what = NULL, *who = NULL; assert (p != NULL); dienow = IDL_tree_get_node_info (p, &what, &who); assert (what != NULL); if (who && *who) IDL_tree_error (p, "%s %s `%s'", message, what, who); else IDL_tree_error (p, "%s %s", message, what); return dienow; } static void illegal_context_type_error (IDL_tree p, const char *what) { GString *s = g_string_new (NULL); g_string_sprintf (s, "Illegal type `%%s' for %s", what); illegal_type_error (p, s->str); g_string_free (s, TRUE); } static void illegal_type_error (IDL_tree p, const char *message) { GString *s; s = IDL_tree_to_IDL_string (p, NULL, IDLF_OUTPUT_NO_NEWLINES); yyerrorv (message, s->str); g_string_free (s, TRUE); } static IDL_tree list_start (IDL_tree a, gboolean filter_null) { IDL_tree p; if (!a && filter_null) return NULL; p = IDL_list_new (a); return p; } static IDL_tree list_chain (IDL_tree a, IDL_tree b, gboolean filter_null) { IDL_tree p; if (filter_null) { if (!b) return a; if (!a) return list_start (b, filter_null); } p = IDL_list_new (b); a = IDL_list_concat (a, p); return a; } static IDL_tree zlist_chain (IDL_tree a, IDL_tree b, gboolean filter_null) { if (a == NULL) return list_start (b, filter_null); else return list_chain (a, b, filter_null); } static int IDL_binop_chktypes (enum IDL_binop op, IDL_tree a, IDL_tree b) { if (IDL_NODE_TYPE (a) != IDLN_BINOP && IDL_NODE_TYPE (b) != IDLN_BINOP && IDL_NODE_TYPE (a) != IDLN_UNARYOP && IDL_NODE_TYPE (b) != IDLN_UNARYOP && IDL_NODE_TYPE (a) != IDL_NODE_TYPE (b)) { yyerror ("Invalid mix of types in constant expression"); return -1; } switch (op) { case IDL_BINOP_MULT: case IDL_BINOP_DIV: case IDL_BINOP_ADD: case IDL_BINOP_SUB: break; case IDL_BINOP_MOD: case IDL_BINOP_SHR: case IDL_BINOP_SHL: case IDL_BINOP_AND: case IDL_BINOP_OR: case IDL_BINOP_XOR: if ((IDL_NODE_TYPE (a) != IDLN_INTEGER || IDL_NODE_TYPE (b) != IDLN_INTEGER) && !(IDL_NODE_TYPE (a) == IDLN_BINOP || IDL_NODE_TYPE (b) == IDLN_BINOP || IDL_NODE_TYPE (a) == IDLN_UNARYOP || IDL_NODE_TYPE (b) == IDLN_UNARYOP)) { yyerror ("Invalid operation on non-integer value"); return -1; } break; } return 0; } static int IDL_unaryop_chktypes (enum IDL_unaryop op, IDL_tree a) { switch (op) { case IDL_UNARYOP_PLUS: case IDL_UNARYOP_MINUS: break; case IDL_UNARYOP_COMPLEMENT: if (IDL_NODE_TYPE (a) != IDLN_INTEGER && !(IDL_NODE_TYPE (a) == IDLN_BINOP || IDL_NODE_TYPE (a) == IDLN_UNARYOP)) { yyerror ("Operand to complement must be integer"); return -1; } break; } return 0; } static IDL_tree IDL_binop_eval_integer (enum IDL_binop op, IDL_tree a, IDL_tree b) { IDL_tree p = NULL; assert (IDL_NODE_TYPE (a) == IDLN_INTEGER); switch (op) { case IDL_BINOP_MULT: p = IDL_integer_new (IDL_INTEGER (a).value * IDL_INTEGER (b).value); break; case IDL_BINOP_DIV: if (IDL_INTEGER (b).value == 0) { yyerror ("Divide by zero in constant expression"); return NULL; } p = IDL_integer_new (IDL_INTEGER (a).value / IDL_INTEGER (b).value); break; case IDL_BINOP_ADD: p = IDL_integer_new (IDL_INTEGER (a).value + IDL_INTEGER (b).value); break; case IDL_BINOP_SUB: p = IDL_integer_new (IDL_INTEGER (a).value - IDL_INTEGER (b).value); break; case IDL_BINOP_MOD: if (IDL_INTEGER (b).value == 0) { yyerror ("Modulo by zero in constant expression"); return NULL; } p = IDL_integer_new (IDL_INTEGER (a).value % IDL_INTEGER (b).value); break; case IDL_BINOP_SHR: p = IDL_integer_new (IDL_INTEGER (a).value >> IDL_INTEGER (b).value); break; case IDL_BINOP_SHL: p = IDL_integer_new (IDL_INTEGER (a).value << IDL_INTEGER (b).value); break; case IDL_BINOP_AND: p = IDL_integer_new (IDL_INTEGER (a).value & IDL_INTEGER (b).value); break; case IDL_BINOP_OR: p = IDL_integer_new (IDL_INTEGER (a).value | IDL_INTEGER (b).value); break; case IDL_BINOP_XOR: p = IDL_integer_new (IDL_INTEGER (a).value ^ IDL_INTEGER (b).value); break; } return p; } static IDL_tree IDL_binop_eval_float (enum IDL_binop op, IDL_tree a, IDL_tree b) { IDL_tree p = NULL; assert (IDL_NODE_TYPE (a) == IDLN_FLOAT); switch (op) { case IDL_BINOP_MULT: p = IDL_float_new (IDL_FLOAT (a).value * IDL_FLOAT (b).value); break; case IDL_BINOP_DIV: if (IDL_FLOAT (b).value == 0.0) { yyerror ("Divide by zero in constant expression"); return NULL; } p = IDL_float_new (IDL_FLOAT (a).value / IDL_FLOAT (b).value); break; case IDL_BINOP_ADD: p = IDL_float_new (IDL_FLOAT (a).value + IDL_FLOAT (b).value); break; case IDL_BINOP_SUB: p = IDL_float_new (IDL_FLOAT (a).value - IDL_FLOAT (b).value); break; default: break; } return p; } static IDL_tree IDL_binop_eval (enum IDL_binop op, IDL_tree a, IDL_tree b) { assert (IDL_NODE_TYPE (a) == IDL_NODE_TYPE (b)); switch (IDL_NODE_TYPE (a)) { case IDLN_INTEGER: return IDL_binop_eval_integer (op, a, b); case IDLN_FLOAT: return IDL_binop_eval_float (op, a, b); default: return NULL; } } static IDL_tree IDL_unaryop_eval_integer (enum IDL_unaryop op, IDL_tree a) { IDL_tree p = NULL; assert (IDL_NODE_TYPE (a) == IDLN_INTEGER); switch (op) { case IDL_UNARYOP_PLUS: p = IDL_integer_new (IDL_INTEGER (a).value); break; case IDL_UNARYOP_MINUS: p = IDL_integer_new (-IDL_INTEGER (a).value); break; case IDL_UNARYOP_COMPLEMENT: p = IDL_integer_new (~IDL_INTEGER (a).value); break; } return p; } static IDL_tree IDL_unaryop_eval_fixed (enum IDL_unaryop op, IDL_tree a) { IDL_tree p = NULL; assert (IDL_NODE_TYPE (a) == IDLN_FIXED); switch (op) { case IDL_UNARYOP_PLUS: p = IDL_fixed_new (IDL_FIXED (a).value); break; default: break; } return p; } static IDL_tree IDL_unaryop_eval_float (enum IDL_unaryop op, IDL_tree a) { IDL_tree p = NULL; assert (IDL_NODE_TYPE (a) == IDLN_FLOAT); switch (op) { case IDL_UNARYOP_PLUS: p = IDL_float_new (IDL_FLOAT (a).value); break; case IDL_UNARYOP_MINUS: p = IDL_float_new (-IDL_FLOAT (a).value); break; default: break; } return p; } static IDL_tree IDL_unaryop_eval (enum IDL_unaryop op, IDL_tree a) { switch (IDL_NODE_TYPE (a)) { case IDLN_INTEGER: return IDL_unaryop_eval_integer (op, a); case IDLN_FIXED: return IDL_unaryop_eval_fixed (op, a); case IDLN_FLOAT: return IDL_unaryop_eval_float (op, a); default: return NULL; } } IDL_tree IDL_resolve_const_exp (IDL_tree p, IDL_tree_type type) { gboolean resolved_value = FALSE, die = FALSE; gboolean wrong_type = FALSE; while (!resolved_value && !die) { if (IDL_NODE_TYPE (p) == IDLN_IDENT) { IDL_tree q = IDL_NODE_UP (p); assert (q != NULL); if (IDL_NODE_UP (q) && IDL_NODE_TYPE (IDL_NODE_UP (q)) == IDLN_TYPE_ENUM) { p = q; die = TRUE; break; } else if (IDL_NODE_TYPE (q) != IDLN_CONST_DCL) { p = q; wrong_type = TRUE; die = TRUE; } else p = IDL_CONST_DCL (q).const_exp; } if (p == NULL || IDL_NODE_TYPE (p) == IDLN_BINOP || IDL_NODE_TYPE (p) == IDLN_UNARYOP) { die = TRUE; continue; } resolved_value = IDL_NODE_IS_LITERAL (p); } if (resolved_value && type != IDLN_ANY && IDL_NODE_TYPE (p) != type) wrong_type = TRUE; if (wrong_type) { yyerror ("Invalid type for constant"); IDL_tree_error (p, "Previous resolved type declaration"); return NULL; } return resolved_value ? p : NULL; } void IDL_queue_new_ident_comment (const char *str) { g_return_if_fail (str != NULL); __IDL_new_ident_comments = g_slist_append (__IDL_new_ident_comments, g_strdup (str)); } /* * Local variables: * mode: C * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: t * End: */