diff --git a/direct/src/dcparser/dcClass.cxx b/direct/src/dcparser/dcClass.cxx index 146727c917..ceed3f5ec3 100644 --- a/direct/src/dcparser/dcClass.cxx +++ b/direct/src/dcparser/dcClass.cxx @@ -805,6 +805,10 @@ void DCClass:: generate_hash(HashGenerator &hashgen) const { hashgen.add_string(_name); + if (is_struct()) { + hashgen.add_int(1); + } + hashgen.add_int(_parents.size()); Parents::const_iterator pi; for (pi = _parents.begin(); pi != _parents.end(); ++pi) { diff --git a/direct/src/dcparser/dcParser.cxx.prebuilt b/direct/src/dcparser/dcParser.cxx.prebuilt index c63e0bdf4f..6820b1010c 100644 --- a/direct/src/dcparser/dcParser.cxx.prebuilt +++ b/direct/src/dcparser/dcParser.cxx.prebuilt @@ -122,12 +122,12 @@ dc_cleanup_parser() { -#define YYFINAL 223 +#define YYFINAL 245 #define YYFLAG -32768 #define YYNTBASE 61 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 300 ? yytranslate[x] : 120) +#define YYTRANSLATE(x) ((unsigned)(x) <= 300 ? yytranslate[x] : 127) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = @@ -136,7 +136,7 @@ static const char yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 55, 56, 52, 2, 53, 58, 51, 50, 2, 2, + 55, 56, 50, 2, 51, 58, 49, 48, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 54, 47, 2, 57, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -144,7 +144,7 @@ static const char yytranslate[] = 2, 59, 2, 60, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 48, 2, 49, 2, 2, 2, 2, + 2, 2, 2, 52, 2, 53, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -169,68 +169,73 @@ static const char yytranslate[] = static const short yyprhs[] = { 0, 0, 3, 6, 8, 11, 14, 17, 20, 23, - 24, 32, 34, 36, 38, 40, 44, 46, 50, 53, - 54, 60, 62, 64, 66, 70, 73, 75, 78, 80, - 84, 86, 89, 92, 94, 96, 100, 103, 104, 111, - 113, 115, 117, 121, 123, 124, 129, 130, 134, 136, - 138, 140, 142, 147, 151, 158, 165, 167, 169, 171, - 173, 175, 179, 182, 186, 192, 197, 199, 201, 205, - 209, 215, 217, 222, 224, 228, 233, 235, 237, 239, - 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, - 261, 263, 264, 269, 270, 275, 276, 281, 285, 289, - 293, 297, 299, 302, 304, 306, 308, 312, 314, 316, - 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, - 338, 340, 342, 344, 346, 348, 350, 352, 354, 357, - 360, 363, 366, 369, 372, 375, 378, 381, 382, 387, - 389, 391, 395, 397, 399, 400, 410, 412, 415, 418, - 421, 422, 427, 430, 432 + 25, 29, 31, 35, 38, 39, 45, 47, 49, 51, + 55, 58, 60, 62, 63, 71, 73, 75, 78, 80, + 84, 86, 89, 92, 95, 97, 101, 104, 105, 113, + 115, 117, 120, 122, 126, 128, 131, 134, 136, 138, + 141, 143, 144, 150, 152, 154, 156, 160, 162, 163, + 168, 169, 173, 175, 177, 179, 181, 186, 190, 197, + 204, 206, 208, 210, 212, 214, 218, 221, 225, 231, + 236, 238, 240, 244, 248, 254, 256, 261, 263, 267, + 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, + 292, 294, 296, 298, 300, 302, 303, 308, 309, 314, + 315, 320, 324, 328, 332, 336, 338, 341, 343, 345, + 347, 351, 353, 355, 357, 359, 361, 363, 365, 367, + 369, 371, 373, 375, 377, 379, 381, 383, 385, 387, + 389, 391, 393, 396, 399, 402, 405, 408, 411, 414, + 417, 420, 421, 426, 428, 430, 434, 436, 438, 439, + 449, 451, 454, 457, 460, 461, 466, 469, 471 }; static const short yyrhs[] = { - 45, 62, 0, 46, 99, 0, 119, 0, 62, 47, - 0, 62, 63, 0, 62, 113, 0, 62, 69, 0, - 62, 73, 0, 0, 65, 112, 64, 74, 48, 76, - 49, 0, 10, 0, 9, 0, 8, 0, 8, 0, - 67, 50, 8, 0, 67, 0, 68, 51, 67, 0, - 12, 68, 0, 0, 11, 68, 12, 70, 71, 0, - 72, 0, 52, 0, 67, 0, 72, 53, 67, 0, - 13, 87, 0, 119, 0, 54, 75, 0, 66, 0, - 75, 53, 66, 0, 119, 0, 76, 47, 0, 76, - 77, 0, 78, 0, 108, 0, 86, 107, 47, 0, - 84, 107, 0, 0, 8, 55, 79, 80, 56, 107, - 0, 119, 0, 81, 0, 82, 0, 81, 53, 82, - 0, 87, 0, 0, 87, 57, 83, 99, 0, 0, - 91, 85, 92, 0, 91, 0, 84, 0, 86, 0, - 106, 0, 106, 55, 89, 56, 0, 106, 50, 94, - 0, 106, 50, 94, 55, 89, 56, 0, 106, 55, - 89, 56, 50, 94, 0, 8, 0, 63, 0, 113, - 0, 119, 0, 98, 0, 98, 58, 98, 0, 98, - 97, 0, 89, 53, 98, 0, 89, 53, 98, 58, - 98, 0, 89, 53, 98, 97, 0, 119, 0, 93, - 0, 93, 58, 93, 0, 90, 53, 93, 0, 90, - 53, 93, 58, 93, 0, 88, 0, 91, 59, 90, - 60, 0, 8, 0, 92, 50, 94, 0, 92, 59, - 90, 60, 0, 6, 0, 94, 0, 3, 0, 4, - 0, 3, 0, 96, 0, 95, 0, 5, 0, 6, - 0, 97, 0, 95, 0, 96, 0, 5, 0, 6, - 0, 7, 0, 0, 48, 100, 103, 49, 0, 0, - 59, 101, 103, 60, 0, 0, 55, 102, 103, 56, - 0, 95, 52, 94, 0, 96, 52, 94, 0, 5, - 52, 94, 0, 7, 52, 94, 0, 104, 0, 105, - 104, 0, 119, 0, 53, 0, 99, 0, 105, 53, - 99, 0, 16, 0, 17, 0, 18, 0, 19, 0, - 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, - 25, 0, 26, 0, 27, 0, 28, 0, 29, 0, - 30, 0, 31, 0, 32, 0, 33, 0, 34, 0, - 35, 0, 119, 0, 107, 36, 0, 107, 37, 0, - 107, 38, 0, 107, 39, 0, 107, 40, 0, 107, - 41, 0, 107, 42, 0, 107, 43, 0, 107, 44, - 0, 0, 8, 54, 109, 111, 0, 8, 0, 110, - 0, 111, 53, 110, 0, 119, 0, 8, 0, 0, - 14, 112, 55, 87, 56, 48, 114, 115, 49, 0, - 119, 0, 115, 47, 0, 115, 116, 0, 115, 118, - 0, 0, 15, 117, 99, 54, 0, 86, 47, 0, - 84, 0, 0 + 45, 62, 0, 46, 106, 0, 126, 0, 62, 47, + 0, 62, 70, 0, 62, 120, 0, 62, 65, 0, + 62, 69, 0, 8, 0, 63, 48, 8, 0, 63, + 0, 64, 49, 63, 0, 12, 64, 0, 0, 11, + 64, 12, 66, 67, 0, 68, 0, 50, 0, 63, + 0, 68, 51, 63, 0, 13, 94, 0, 71, 0, + 78, 0, 0, 9, 119, 72, 74, 52, 76, 53, + 0, 8, 0, 126, 0, 54, 75, 0, 73, 0, + 75, 51, 73, 0, 126, 0, 76, 47, 0, 76, + 77, 0, 85, 114, 0, 115, 0, 93, 114, 47, + 0, 91, 114, 0, 0, 10, 119, 79, 81, 52, + 83, 53, 0, 8, 0, 126, 0, 54, 82, 0, + 80, 0, 82, 51, 80, 0, 126, 0, 83, 47, + 0, 83, 84, 0, 85, 0, 115, 0, 93, 47, + 0, 91, 0, 0, 8, 55, 86, 87, 56, 0, + 126, 0, 88, 0, 89, 0, 88, 51, 89, 0, + 94, 0, 0, 94, 57, 90, 106, 0, 0, 98, + 92, 99, 0, 98, 0, 91, 0, 93, 0, 113, + 0, 113, 55, 96, 56, 0, 113, 48, 101, 0, + 113, 48, 101, 55, 96, 56, 0, 113, 55, 96, + 56, 48, 101, 0, 8, 0, 78, 0, 120, 0, + 126, 0, 105, 0, 105, 58, 105, 0, 105, 104, + 0, 96, 51, 105, 0, 96, 51, 105, 58, 105, + 0, 96, 51, 105, 104, 0, 126, 0, 100, 0, + 100, 58, 100, 0, 97, 51, 100, 0, 97, 51, + 100, 58, 100, 0, 95, 0, 98, 59, 97, 60, + 0, 8, 0, 99, 48, 101, 0, 99, 59, 97, + 60, 0, 6, 0, 101, 0, 3, 0, 4, 0, + 3, 0, 103, 0, 102, 0, 5, 0, 6, 0, + 104, 0, 102, 0, 103, 0, 5, 0, 6, 0, + 7, 0, 0, 52, 107, 110, 53, 0, 0, 59, + 108, 110, 60, 0, 0, 55, 109, 110, 56, 0, + 102, 50, 101, 0, 103, 50, 101, 0, 5, 50, + 101, 0, 7, 50, 101, 0, 111, 0, 112, 111, + 0, 126, 0, 51, 0, 106, 0, 112, 51, 106, + 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, + 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, + 0, 26, 0, 27, 0, 28, 0, 29, 0, 30, + 0, 31, 0, 32, 0, 33, 0, 34, 0, 35, + 0, 126, 0, 114, 36, 0, 114, 37, 0, 114, + 38, 0, 114, 39, 0, 114, 40, 0, 114, 41, + 0, 114, 42, 0, 114, 43, 0, 114, 44, 0, + 0, 8, 54, 116, 118, 0, 8, 0, 117, 0, + 118, 51, 117, 0, 126, 0, 8, 0, 0, 14, + 119, 55, 94, 56, 52, 121, 122, 53, 0, 126, + 0, 122, 47, 0, 122, 123, 0, 122, 125, 0, + 0, 15, 124, 106, 54, 0, 93, 47, 0, 91, + 0, 0 }; #endif @@ -239,22 +244,23 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 147, 149, 152, 154, 155, 166, 172, 173, 176, - 176, 189, 194, 200, 214, 216, 222, 224, 230, 235, - 235, 242, 244, 250, 255, 261, 277, 279, 282, 289, - 297, 299, 300, 308, 310, 311, 316, 323, 323, 337, - 339, 342, 344, 347, 353, 353, 378, 378, 389, 393, - 395, 398, 403, 411, 422, 436, 450, 476, 482, 490, - 495, 502, 509, 518, 524, 530, 540, 545, 552, 559, - 565, 573, 575, 581, 587, 601, 607, 617, 620, 631, - 635, 639, 644, 648, 651, 661, 665, 670, 674, 678, - 682, 686, 686, 694, 694, 702, 702, 710, 716, 722, - 728, 736, 738, 741, 743, 746, 748, 751, 756, 760, - 764, 768, 772, 776, 780, 784, 788, 792, 796, 800, - 804, 808, 812, 816, 820, 824, 828, 834, 839, 843, - 847, 851, 855, 859, 863, 867, 871, 877, 877, 888, - 904, 911, 924, 929, 932, 932, 946, 948, 949, 950, - 960, 960, 977, 982, 988 + 0, 150, 152, 155, 157, 158, 169, 175, 176, 179, + 181, 187, 189, 195, 200, 200, 207, 209, 215, 220, + 226, 242, 244, 247, 247, 260, 277, 279, 282, 289, + 297, 299, 300, 308, 314, 315, 320, 327, 327, 340, + 357, 359, 362, 369, 377, 379, 380, 388, 390, 391, + 395, 401, 401, 414, 416, 419, 421, 424, 430, 430, + 455, 455, 466, 470, 472, 475, 480, 488, 499, 513, + 527, 556, 562, 570, 575, 582, 589, 598, 604, 610, + 620, 625, 632, 639, 645, 653, 655, 661, 667, 681, + 687, 697, 700, 711, 715, 719, 724, 728, 731, 741, + 745, 750, 754, 758, 762, 766, 766, 774, 774, 782, + 782, 790, 796, 802, 808, 816, 818, 821, 823, 826, + 828, 831, 836, 840, 844, 848, 852, 856, 860, 864, + 868, 872, 876, 880, 884, 888, 892, 896, 900, 904, + 908, 914, 919, 923, 927, 931, 935, 939, 943, 947, + 951, 957, 957, 968, 984, 991, 1004, 1009, 1012, 1012, + 1026, 1028, 1029, 1030, 1040, 1040, 1057, 1062, 1068 }; #endif @@ -273,65 +279,68 @@ static const char *const yytname[] = "KW_UINT8ARRAY", "KW_UINT16ARRAY", "KW_UINT32ARRAY", "KW_UINT32UINT8ARRAY", "KW_CHAR", "KW_REQUIRED", "KW_BROADCAST", "KW_P2P", "KW_RAM", "KW_DB", "KW_CLSEND", "KW_CLRECV", "KW_OWNSEND", - "KW_AIRECV", "START_DC", "START_PARAMETER_VALUE", "';'", "'{'", "'}'", - "'/'", "'.'", "'*'", "','", "':'", "'('", "')'", "'='", "'-'", "'['", - "']'", "grammar", "dc", "dclass", "@1", "kw_struct_or_kw_dclass", - "dclass_name", "slash_identifier", "import_identifier", "import", "@2", - "import_symbol_list_or_star", "import_symbol_list", "typedef_decl", - "dclass_derivation", "base_list", "dclass_fields", "dclass_field", - "atomic_field", "@3", "parameter_list", "nonempty_parameter_list", - "atomic_element", "@4", "named_parameter", "@5", "unnamed_parameter", - "parameter", "type_name", "double_range", "uint_range", - "type_definition", "parameter_definition", "char_or_uint", - "small_unsigned_integer", "signed_integer", "unsigned_integer", - "number", "char_or_number", "parameter_value", "@6", "@7", "@8", - "array", "maybe_comma", "array_def", "type_token", "server_flags", - "molecular_field", "@9", "atomic_name", "molecular_atom_list", - "optional_name", "switch", "@10", "switch_fields", "switch_case", "@11", - "switch_field", "empty", 0 + "KW_AIRECV", "START_DC", "START_PARAMETER_VALUE", "';'", "'/'", "'.'", + "'*'", "','", "'{'", "'}'", "':'", "'('", "')'", "'='", "'-'", "'['", + "']'", "grammar", "dc", "slash_identifier", "import_identifier", + "import", "@1", "import_symbol_list_or_star", "import_symbol_list", + "typedef_decl", "dclass_or_struct", "dclass", "@2", "dclass_name", + "dclass_derivation", "dclass_base_list", "dclass_fields", + "dclass_field", "struct", "@3", "struct_name", "struct_derivation", + "struct_base_list", "struct_fields", "struct_field", "atomic_field", + "@4", "parameter_list", "nonempty_parameter_list", "atomic_element", + "@5", "named_parameter", "@6", "unnamed_parameter", "parameter", + "type_name", "double_range", "uint_range", "type_definition", + "parameter_definition", "char_or_uint", "small_unsigned_integer", + "signed_integer", "unsigned_integer", "number", "char_or_number", + "parameter_value", "@7", "@8", "@9", "array", "maybe_comma", + "array_def", "type_token", "server_flags", "molecular_field", "@10", + "atomic_name", "molecular_atom_list", "optional_name", "switch", "@11", + "switch_fields", "switch_case", "@12", "switch_field", "empty", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { - 0, 61, 61, 62, 62, 62, 62, 62, 62, 64, - 63, 65, 65, 66, 67, 67, 68, 68, 69, 70, - 69, 71, 71, 72, 72, 73, 74, 74, 75, 75, + 0, 61, 61, 62, 62, 62, 62, 62, 62, 63, + 63, 64, 64, 65, 66, 65, 67, 67, 68, 68, + 69, 70, 70, 72, 71, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 77, 77, 79, 78, 80, - 80, 81, 81, 82, 83, 82, 85, 84, 86, 87, - 87, 88, 88, 88, 88, 88, 88, 88, 88, 89, - 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, - 90, 91, 91, 92, 92, 92, 93, 93, 94, 95, - 96, 97, 97, 97, 98, 98, 99, 99, 99, 99, - 99, 100, 99, 101, 99, 102, 99, 99, 99, 99, - 99, 103, 103, 104, 104, 105, 105, 106, 106, 106, - 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 109, 108, 110, - 111, 111, 112, 112, 114, 113, 115, 115, 115, 115, - 117, 116, 118, 118, 119 + 81, 81, 82, 82, 83, 83, 83, 84, 84, 84, + 84, 86, 85, 87, 87, 88, 88, 89, 90, 89, + 92, 91, 93, 94, 94, 95, 95, 95, 95, 95, + 95, 95, 95, 96, 96, 96, 96, 96, 96, 96, + 97, 97, 97, 97, 97, 98, 98, 99, 99, 99, + 100, 100, 101, 102, 103, 104, 104, 104, 105, 105, + 106, 106, 106, 106, 106, 107, 106, 108, 106, 109, + 106, 106, 106, 106, 106, 110, 110, 111, 111, 112, + 112, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 116, 115, 117, 118, 118, 119, 119, 121, 120, + 122, 122, 122, 122, 124, 123, 125, 125, 126 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { - 0, 2, 2, 1, 2, 2, 2, 2, 2, 0, - 7, 1, 1, 1, 1, 3, 1, 3, 2, 0, - 5, 1, 1, 1, 3, 2, 1, 2, 1, 3, - 1, 2, 2, 1, 1, 3, 2, 0, 6, 1, - 1, 1, 3, 1, 0, 4, 0, 3, 1, 1, - 1, 1, 4, 3, 6, 6, 1, 1, 1, 1, - 1, 3, 2, 3, 5, 4, 1, 1, 3, 3, - 5, 1, 4, 1, 3, 4, 1, 1, 1, 1, + 0, 2, 2, 1, 2, 2, 2, 2, 2, 1, + 3, 1, 3, 2, 0, 5, 1, 1, 1, 3, + 2, 1, 1, 0, 7, 1, 1, 2, 1, 3, + 1, 2, 2, 2, 1, 3, 2, 0, 7, 1, + 1, 2, 1, 3, 1, 2, 2, 1, 1, 2, + 1, 0, 5, 1, 1, 1, 3, 1, 0, 4, + 0, 3, 1, 1, 1, 1, 4, 3, 6, 6, + 1, 1, 1, 1, 1, 3, 2, 3, 5, 4, + 1, 1, 3, 3, 5, 1, 4, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 4, 0, 4, 0, 4, 3, 3, 3, - 3, 1, 2, 1, 1, 1, 3, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 4, 0, 4, 0, + 4, 3, 3, 3, 3, 1, 2, 1, 1, 1, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 0, 4, 1, - 1, 3, 1, 1, 0, 9, 1, 2, 2, 2, - 0, 4, 2, 1, 0 + 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 0, 4, 1, 1, 3, 1, 1, 0, 9, + 1, 2, 2, 2, 0, 4, 2, 1, 0 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -339,144 +348,156 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - 0, 154, 0, 1, 3, 80, 79, 88, 89, 90, - 91, 95, 93, 86, 87, 2, 12, 11, 0, 0, - 0, 154, 4, 5, 154, 7, 8, 6, 0, 0, - 154, 154, 154, 0, 0, 14, 16, 0, 18, 56, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 57, 49, 50, 25, 71, 48, 51, 58, 143, 0, - 142, 9, 78, 99, 100, 104, 105, 0, 101, 154, - 103, 0, 0, 97, 98, 0, 19, 0, 154, 0, - 0, 154, 0, 154, 92, 104, 102, 96, 94, 15, - 0, 17, 76, 0, 67, 77, 66, 73, 47, 53, - 83, 84, 0, 82, 81, 85, 60, 59, 0, 0, - 0, 26, 106, 22, 23, 20, 21, 0, 72, 0, - 0, 154, 154, 0, 52, 0, 62, 0, 13, 28, - 27, 154, 0, 69, 68, 74, 0, 0, 63, 0, - 61, 144, 0, 0, 30, 24, 0, 75, 54, 0, - 65, 55, 154, 29, 56, 31, 10, 32, 33, 154, - 154, 34, 70, 64, 0, 146, 137, 37, 36, 127, - 0, 150, 147, 145, 153, 0, 148, 149, 0, 154, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 35, - 0, 152, 139, 140, 138, 0, 40, 41, 43, 39, - 0, 0, 154, 0, 44, 151, 141, 38, 42, 0, - 45, 0, 0, 0 + 0, 168, 0, 1, 3, 94, 93, 102, 103, 104, + 105, 109, 107, 100, 101, 2, 168, 168, 0, 0, + 0, 168, 4, 7, 8, 5, 21, 22, 6, 0, + 0, 168, 168, 168, 0, 0, 157, 23, 156, 37, + 9, 11, 0, 13, 70, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 71, 63, 64, 20, 85, + 62, 65, 72, 0, 92, 113, 114, 118, 119, 0, + 115, 168, 117, 0, 0, 111, 112, 168, 168, 0, + 14, 0, 168, 0, 0, 168, 0, 106, 118, 116, + 110, 108, 0, 0, 26, 0, 0, 40, 10, 0, + 12, 90, 0, 81, 91, 80, 87, 61, 67, 97, + 98, 0, 96, 95, 99, 74, 73, 0, 120, 25, + 28, 27, 168, 39, 42, 41, 168, 17, 18, 15, + 16, 0, 86, 0, 0, 168, 168, 0, 66, 0, + 76, 0, 0, 0, 30, 0, 0, 44, 0, 83, + 82, 88, 0, 0, 77, 0, 75, 158, 29, 70, + 31, 24, 32, 168, 168, 168, 34, 43, 45, 38, + 46, 47, 50, 0, 48, 19, 0, 89, 68, 0, + 79, 69, 168, 151, 51, 33, 141, 36, 0, 49, + 84, 78, 0, 160, 0, 168, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 35, 164, 161, 159, 167, + 0, 162, 163, 153, 154, 152, 0, 54, 55, 57, + 53, 0, 166, 0, 52, 0, 58, 0, 155, 56, + 0, 165, 59, 0, 0, 0 }; static const short yydefgoto[] = { - 221, 3, 60, 93, 24, 139, 36, 37, 25, 100, - 125, 126, 26, 120, 140, 153, 167, 168, 189, 205, - 206, 207, 219, 61, 89, 62, 208, 64, 112, 103, - 65, 108, 104, 105, 13, 14, 115, 116, 76, 30, - 32, 31, 77, 78, 79, 66, 178, 171, 188, 203, - 204, 69, 67, 162, 174, 186, 200, 187, 80 + 243, 3, 41, 42, 23, 109, 139, 140, 24, 25, + 26, 87, 130, 103, 131, 153, 172, 65, 88, 134, + 106, 135, 156, 180, 173, 205, 226, 227, 228, 240, + 66, 93, 67, 229, 69, 121, 112, 70, 117, 113, + 114, 13, 14, 124, 125, 78, 31, 33, 32, 79, + 80, 81, 71, 195, 176, 204, 224, 225, 37, 72, + 192, 202, 221, 231, 222, 82 }; static const short yypact[] = { - 57,-32768, 36, 87,-32768,-32768,-32768, -15,-32768, -7, - -32768,-32768,-32768, 17, 19,-32768,-32768,-32768, 75, 75, - 240, 82,-32768,-32768, 82,-32768,-32768,-32768, 74, 74, - 9, 9, 9, 74, 74,-32768, 54, 8, 72,-32768, + 7,-32768, 38, 95,-32768,-32768,-32768, -44,-32768, -12, + -32768,-32768,-32768, 4, 32,-32768, 86, 86, 106, 106, + 269, 86,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 127, + 127, 20, 20, 20, 127, 127,-32768,-32768,-32768,-32768, + -32768, 85, 21, 88,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768, -3, 25,-32768,-32768, 73, - -32768,-32768,-32768,-32768,-32768,-32768,-32768, 80,-32768, 77, - -32768, 83, 71,-32768,-32768, 130,-32768, 75, 30, 132, - 74, 115, 240, 110,-32768, 36,-32768,-32768,-32768,-32768, - 24, 54,-32768, -30, 107,-32768,-32768,-32768, -21, 111, - -32768,-32768, 32,-32768,-32768,-32768, 14,-32768, 112, 159, - 121,-32768,-32768,-32768, 54,-32768, 119, 30,-32768, 30, - 74, 30, 115, 115, 123, 115,-32768, 138,-32768,-32768, - 122,-32768, 75, 129,-32768,-32768, 26, 69, 23, 74, - -32768,-32768, 159, 127,-32768, 54, 30,-32768,-32768, 115, - -32768,-32768,-32768,-32768, 61,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, 206,-32768,-32768,-32768, 141,-32768, - 70,-32768,-32768,-32768,-32768, 142,-32768,-32768, 180, 240, + 6, 28,-32768, 76,-32768,-32768,-32768,-32768,-32768, 81, + -32768, 84,-32768, 113, 79,-32768,-32768, 90, 116, 132, + -32768, 106, 107, 163, 127, 96, 269,-32768, 38,-32768, + -32768,-32768, 164, 124,-32768, 169, 126,-32768,-32768, 12, + 85,-32768, -3, 121,-32768,-32768,-32768, -8, 128,-32768, + -32768, 18,-32768,-32768,-32768, 8,-32768, 125,-32768,-32768, + -32768, 131,-32768,-32768,-32768, 134,-32768,-32768, 85,-32768, + 136, 107,-32768, 107, 127, 107, 96, 96, 140, 96, + -32768, 137, 164, 190,-32768, 169, 231,-32768, 106, 135, + -32768,-32768, -1, 35, 26, 127,-32768,-32768,-32768, 57, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 36,-32768,-32768,-32768, 139, 135, 140,-32768, 137,-32768, - 143, 180,-32768, 240,-32768,-32768,-32768, 141,-32768, 36, - -32768, 195, 196,-32768 + -32768,-32768,-32768, 143,-32768, 85, 107,-32768,-32768, 96, + -32768,-32768,-32768,-32768,-32768, 232,-32768, 232, 82,-32768, + -32768,-32768, 133,-32768, 176, 269,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 144,-32768,-32768,-32768,-32768, 145, 138, 146,-32768, 142, + -32768, 38,-32768, 176,-32768, 269,-32768, 141,-32768,-32768, + 38,-32768,-32768, 201, 202,-32768 }; static const short yypgoto[] = { - -32768,-32768, 197,-32768,-32768, 47, -76, 182,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768, -11,-32768, -119,-32768, -92, -19,-32768, 76, 78, - -32768,-32768, -69, -25, -85, -81, -95, -89, -2,-32768, - -32768,-32768, 95, 124,-32768,-32768, -163,-32768,-32768, -6, - -32768, 183, 201,-32768,-32768,-32768,-32768,-32768, 1 + -32768,-32768, -81, 184,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768, 74,-32768,-32768,-32768,-32768, 224,-32768, 73, + -32768,-32768,-32768,-32768, 75,-32768,-32768,-32768, -5,-32768, + -138,-32768, -134, -15,-32768, 87, 89,-32768,-32768, -106, + -27, -91, -86, -79, -100, -2,-32768,-32768,-32768, 83, + 151,-32768,-32768, -47, 80,-32768, 2,-32768, 15, 237, + -32768,-32768,-32768,-32768,-32768, 0 }; -#define YYLAST 275 +#define YYLAST 304 static const short yytable[] = { - 15, 63, 4, 73, 74, -46, 113, 180, 83, 84, - 114, 101, 5, 6, 7, 8, 9, 5, 6, 110, - 86, 136, 70, 127, 124, 70, 5, 6, 110, 130, - 128, 113, 35, 72, 169, 114, 102, 28, 131, 5, - 6, 7, 8, 9, 148, 29, 150, 113, 113, 217, - 113, 114, 114, 160, 114, 184, 88, 10, 143, 87, - 144, 170, 75, 113, 11, 109, 155, 114, 12, 33, - 173, 34, 135, 118, 113, 90, 123, 72, 114, 127, - 91, 159, 185, 35, 10, 133, 157, 172, 134, 106, - 68, 11, 117, 122, 121, 12, 16, 17, 18, 19, - 20, 21, 1, 2, 85, 145, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 176, 177, 199, 5, 6, - 110, 111, 133, 87, 161, 158, 81, 82, 92, 94, - 95, 98, 106, 117, 22, 164, 16, 17, 99, 97, - 107, 21, 154, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 175, 119, 129, 132, 138, 137, 141, - 179, 179, 142, 149, 165, 152, 166, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 151, 156, 202, 201, - 209, 212, 211, 213, 214, 222, 223, 215, 210, 163, - 23, 38, 218, 96, 27, 216, 0, 71, 147, 146, - 0, 0, 0, 179, 39, 16, 17, 220, 0, 0, - 21, 181, 40, 41, 42, 43, 44, 45, 46, 47, + 15, 4, 75, 76, 122, 68, 29, 85, 86, 123, + 110, 5, 6, 119, -60, 174, 38, 38, 182, 175, + 40, 38, 183, 5, 6, 7, 8, 9, 138, 5, + 6, 119, 39, 90, 122, 159, 73, 160, 30, 123, + 144, 5, 6, 7, 8, 9, 150, 164, 141, 166, + 141, 145, 1, 2, 34, 122, 122, 142, 122, 187, + 123, 123, 137, 123, 219, 92, 149, 118, 220, 147, + 91, 77, 10, 122, 148, 11, 94, 185, 123, 12, + 200, 127, 35, 95, 189, 190, 147, 104, 107, 201, + 10, 188, 115, 11, 36, 126, 128, 12, 122, 5, + 6, 119, 120, 123, 16, 17, 18, 19, 20, 21, + 74, 193, 194, 111, 40, 83, 84, 161, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 197, 198, 215, + 74, 96, 154, 89, 97, 98, 157, 91, 191, 101, + 108, 44, 22, 17, 102, 115, 126, 21, 216, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 100, + 105, 116, 129, 196, 196, 196, 132, 133, 136, 143, + 217, 151, 152, 146, 223, 155, 218, 158, 165, 167, + 199, 232, 203, 186, 234, 241, 233, 235, 169, 236, + 17, 244, 245, 43, 21, 230, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 168, 27, 177, 237, + 239, 181, 99, 163, 162, 238, 184, 170, 242, 169, + 28, 17, 0, 171, 0, 21, 0, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 0, 0, 0, 0, 0, 0, 39, 16, - 17, 0, 0, 182, 21, 183, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59 + 58, 59, 60, 61, 62, 63, 64, 0, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 44, 178, 17, + 0, 0, 0, 21, 179, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64 }; static const short yycheck[] = { - 2, 20, 1, 28, 29, 8, 91, 170, 33, 34, - 91, 87, 3, 4, 5, 6, 7, 3, 4, 5, - 12, 116, 21, 53, 100, 24, 3, 4, 5, 50, - 60, 116, 8, 3, 153, 116, 6, 52, 59, 3, - 4, 5, 6, 7, 133, 52, 135, 132, 133, 212, - 135, 132, 133, 148, 135, 174, 59, 48, 127, 51, - 129, 153, 53, 148, 55, 90, 142, 148, 59, 52, - 159, 52, 58, 92, 159, 50, 52, 3, 159, 53, - 55, 58, 174, 8, 48, 53, 60, 156, 56, 88, - 8, 55, 91, 95, 93, 59, 9, 10, 11, 12, - 13, 14, 45, 46, 50, 130, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 54, 55, 47, 3, 4, - 5, 6, 53, 51, 149, 56, 31, 32, 55, 49, - 53, 60, 131, 132, 47, 8, 9, 10, 8, 56, - 8, 14, 141, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 162, 54, 58, 55, 8, 56, 48, - 169, 170, 53, 50, 47, 53, 49, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 48, 58, 8, 47, - 189, 56, 53, 53, 57, 0, 0, 54, 200, 152, - 3, 19, 213, 79, 3, 211, -1, 24, 132, 131, - -1, -1, -1, 212, 8, 9, 10, 219, -1, -1, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, -1, -1, -1, -1, -1, -1, 8, 9, - 10, -1, -1, 47, 14, 49, 16, 17, 18, 19, + 2, 1, 29, 30, 95, 20, 50, 34, 35, 95, + 91, 3, 4, 5, 8, 153, 16, 17, 156, 153, + 8, 21, 156, 3, 4, 5, 6, 7, 109, 3, + 4, 5, 17, 12, 125, 141, 21, 143, 50, 125, + 48, 3, 4, 5, 6, 7, 125, 147, 51, 149, + 51, 59, 45, 46, 50, 146, 147, 60, 149, 60, + 146, 147, 50, 149, 202, 59, 58, 94, 202, 51, + 49, 51, 52, 164, 56, 55, 48, 158, 164, 59, + 186, 96, 50, 55, 58, 164, 51, 87, 88, 189, + 52, 56, 92, 55, 8, 95, 98, 59, 189, 3, + 4, 5, 6, 189, 9, 10, 11, 12, 13, 14, + 3, 54, 55, 6, 8, 32, 33, 144, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 174, 175, 47, + 3, 55, 132, 48, 53, 51, 136, 49, 165, 60, + 8, 8, 47, 10, 54, 145, 146, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 56, + 54, 8, 8, 173, 174, 175, 52, 8, 52, 58, + 47, 56, 51, 55, 8, 51, 53, 51, 48, 52, + 47, 47, 192, 58, 56, 54, 51, 51, 8, 57, + 10, 0, 0, 19, 14, 205, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35 + 30, 31, 32, 33, 34, 35, 152, 3, 155, 231, + 235, 156, 81, 146, 145, 233, 156, 47, 240, 8, + 3, 10, -1, 53, -1, 14, -1, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, -1, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 8, 47, 10, + -1, -1, -1, 14, 53, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison/bison.simple" @@ -1186,7 +1207,7 @@ yyreduce: switch (yyn) { case 5: -#line 156 "dcParser.yxx" +#line 159 "dcParser.yxx" { if (!dc_file->add_class(yyvsp[0].u.dclass)) { DCClass *old_class = dc_file->get_class_by_name(yyvsp[0].u.dclass->get_name()); @@ -1199,96 +1220,57 @@ case 5: } break; case 6: -#line 167 "dcParser.yxx" +#line 170 "dcParser.yxx" { if (!dc_file->add_switch(yyvsp[0].u.dswitch)) { yyerror("Duplicate class name: " + yyvsp[0].u.dswitch->get_name()); } } break; -case 9: -#line 178 "dcParser.yxx" -{ - yyval.u.dclass = current_class; - current_class = new DCClass(yyvsp[0].str, yyvsp[-1].u.flag, false); -} - break; case 10: -#line 183 "dcParser.yxx" -{ - yyval.u.dclass = current_class; - current_class = yyvsp[-4].u.dclass; -} - break; -case 11: -#line 191 "dcParser.yxx" -{ - yyval.u.flag = true; -} - break; -case 12: -#line 195 "dcParser.yxx" -{ - yyval.u.flag = false; -} - break; -case 13: -#line 202 "dcParser.yxx" -{ - DCClass *dclass = dc_file->get_class_by_name(yyvsp[0].str); - if (dclass == (DCClass *)NULL) { - // Create a bogus class as a forward reference. - dclass = new DCClass(yyvsp[0].str, false, true); - dc_file->add_class(dclass); - } - - yyval.u.dclass = dclass; -} - break; -case 15: -#line 217 "dcParser.yxx" +#line 182 "dcParser.yxx" { yyval.str = yyvsp[-2].str + string("/") + yyvsp[0].str; } break; -case 17: -#line 225 "dcParser.yxx" +case 12: +#line 190 "dcParser.yxx" { yyval.str = yyvsp[-2].str + string(".") + yyvsp[0].str; } break; -case 18: -#line 232 "dcParser.yxx" +case 13: +#line 197 "dcParser.yxx" { dc_file->add_import_module(yyvsp[0].str); } break; -case 19: -#line 236 "dcParser.yxx" +case 14: +#line 201 "dcParser.yxx" { dc_file->add_import_module(yyvsp[-1].str); } break; -case 22: -#line 245 "dcParser.yxx" +case 17: +#line 210 "dcParser.yxx" { dc_file->add_import_symbol("*"); } break; -case 23: -#line 252 "dcParser.yxx" +case 18: +#line 217 "dcParser.yxx" { dc_file->add_import_symbol(yyvsp[0].str); } break; -case 24: -#line 256 "dcParser.yxx" +case 19: +#line 221 "dcParser.yxx" { dc_file->add_import_symbol(yyvsp[0].str); } break; -case 25: -#line 263 "dcParser.yxx" +case 20: +#line 228 "dcParser.yxx" { DCTypedef *dtypedef = new DCTypedef(yyvsp[0].u.parameter); @@ -1302,6 +1284,36 @@ case 25: } } break; +case 23: +#line 249 "dcParser.yxx" +{ + yyval.u.dclass = current_class; + current_class = new DCClass(yyvsp[0].str, false, false); +} + break; +case 24: +#line 254 "dcParser.yxx" +{ + yyval.u.dclass = current_class; + current_class = yyvsp[-4].u.dclass; +} + break; +case 25: +#line 262 "dcParser.yxx" +{ + DCClass *dclass = dc_file->get_class_by_name(yyvsp[0].str); + if (dclass == (DCClass *)NULL) { + // Create a bogus class as a forward reference. + dclass = new DCClass(yyvsp[0].str, false, true); + dc_file->add_class(dclass); + } + if (dclass->is_struct()) { + yyerror("struct name not allowed"); + } + + yyval.u.dclass = dclass; +} + break; case 28: #line 284 "dcParser.yxx" { @@ -1326,52 +1338,124 @@ case 32: } } break; +case 33: +#line 310 "dcParser.yxx" +{ + yyval.u.field = yyvsp[-1].u.field; + yyval.u.field->set_flags(yyvsp[0].u.s_int); +} + break; case 35: -#line 312 "dcParser.yxx" +#line 316 "dcParser.yxx" { yyval.u.field = yyvsp[-2].u.parameter; yyval.u.field->set_flags(yyvsp[-1].u.s_int); } break; case 36: -#line 317 "dcParser.yxx" +#line 321 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.parameter; yyval.u.field->set_flags(yyvsp[0].u.s_int); } break; case 37: -#line 325 "dcParser.yxx" +#line 329 "dcParser.yxx" +{ + yyval.u.dclass = current_class; + current_class = new DCClass(yyvsp[0].str, true, false); +} + break; +case 38: +#line 334 "dcParser.yxx" +{ + yyval.u.dclass = current_class; + current_class = yyvsp[-4].u.dclass; +} + break; +case 39: +#line 342 "dcParser.yxx" +{ + DCClass *dstruct = dc_file->get_class_by_name(yyvsp[0].str); + if (dstruct == (DCClass *)NULL) { + // Create a bogus class as a forward reference. + dstruct = new DCClass(yyvsp[0].str, false, true); + dc_file->add_class(dstruct); + } + if (!dstruct->is_struct()) { + yyerror("struct name required"); + } + + yyval.u.dclass = dstruct; +} + break; +case 42: +#line 364 "dcParser.yxx" +{ + if (yyvsp[0].u.dclass != (DCClass *)NULL) { + current_class->add_parent(yyvsp[0].u.dclass); + } +} + break; +case 43: +#line 370 "dcParser.yxx" +{ + if (yyvsp[0].u.dclass != (DCClass *)NULL) { + current_class->add_parent(yyvsp[0].u.dclass); + } +} + break; +case 46: +#line 381 "dcParser.yxx" +{ + if (!current_class->add_field(yyvsp[0].u.field)) { + yyerror("Duplicate field name: " + yyvsp[0].u.field->get_name()); + } +} + break; +case 49: +#line 392 "dcParser.yxx" +{ + yyval.u.field = yyvsp[-1].u.parameter; +} + break; +case 50: +#line 396 "dcParser.yxx" +{ + yyval.u.field = yyvsp[0].u.parameter; +} + break; +case 51: +#line 403 "dcParser.yxx" { yyval.u.field = current_atomic; current_atomic = new DCAtomicField(yyvsp[-1].str); } break; -case 38: -#line 330 "dcParser.yxx" +case 52: +#line 408 "dcParser.yxx" { yyval.u.field = current_atomic; - current_atomic = yyvsp[-3].u.atomic; - yyval.u.field->set_flags(yyvsp[0].u.s_int); + current_atomic = yyvsp[-2].u.atomic; } break; -case 43: -#line 349 "dcParser.yxx" +case 57: +#line 426 "dcParser.yxx" { atomic_element = DCAtomicField::ElementType(yyvsp[0].u.parameter); current_atomic->add_element(atomic_element); } break; -case 44: -#line 354 "dcParser.yxx" +case 58: +#line 431 "dcParser.yxx" { current_packer = &default_packer; current_packer->clear_data(); current_packer->begin_pack(yyvsp[-1].u.parameter); } break; -case 45: -#line 360 "dcParser.yxx" +case 59: +#line 437 "dcParser.yxx" { bool is_valid = yyvsp[-3].u.parameter->is_valid(); atomic_element = DCAtomicField::ElementType(yyvsp[-3].u.parameter); @@ -1389,26 +1473,26 @@ case 45: current_atomic->add_element(atomic_element); } break; -case 46: -#line 380 "dcParser.yxx" +case 60: +#line 457 "dcParser.yxx" { current_parameter = yyvsp[0].u.parameter; } break; -case 47: -#line 384 "dcParser.yxx" +case 61: +#line 461 "dcParser.yxx" { yyval.u.parameter = yyvsp[0].u.parameter; } break; -case 51: -#line 400 "dcParser.yxx" +case 65: +#line 477 "dcParser.yxx" { yyval.u.parameter = new DCSimpleParameter(yyvsp[0].u.subatomic); } break; -case 52: -#line 404 "dcParser.yxx" +case 66: +#line 481 "dcParser.yxx" { DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-3].u.subatomic); if (!simple_param->set_range(double_range)) { @@ -1417,8 +1501,8 @@ case 52: yyval.u.parameter = simple_param; } break; -case 53: -#line 412 "dcParser.yxx" +case 67: +#line 489 "dcParser.yxx" { DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-2].u.subatomic); if (yyvsp[0].u.s_uint == 0) { @@ -1430,8 +1514,8 @@ case 53: yyval.u.parameter = simple_param; } break; -case 54: -#line 423 "dcParser.yxx" +case 68: +#line 500 "dcParser.yxx" { DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-5].u.subatomic); if (yyvsp[-3].u.s_uint == 0) { @@ -1446,8 +1530,8 @@ case 54: yyval.u.parameter = simple_param; } break; -case 55: -#line 437 "dcParser.yxx" +case 69: +#line 514 "dcParser.yxx" { DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-5].u.subatomic); if (yyvsp[0].u.s_uint == 0) { @@ -1462,14 +1546,17 @@ case 55: yyval.u.parameter = simple_param; } break; -case 56: -#line 451 "dcParser.yxx" +case 70: +#line 528 "dcParser.yxx" { DCTypedef *dtypedef = dc_file->get_typedef_by_name(yyvsp[0].str); if (dtypedef == (DCTypedef *)NULL) { // Maybe it's a class name. DCClass *dclass = dc_file->get_class_by_name(yyvsp[0].str); if (dclass != (DCClass *)NULL) { + if (!dclass->is_struct()) { + yyerror("cannot embed a dclass object within a message; use a struct"); + } // Create an implicit typedef for this. dtypedef = new DCTypedef(new DCClassParameter(dclass), true); } else { @@ -1490,138 +1577,138 @@ case 56: yyval.u.parameter = dtypedef->make_new_parameter(); } break; -case 57: -#line 477 "dcParser.yxx" +case 71: +#line 557 "dcParser.yxx" { - // This is an inline class definition. + // This is an inline struct definition. dc_file->add_thing_to_delete(yyvsp[0].u.dclass); yyval.u.parameter = new DCClassParameter(yyvsp[0].u.dclass); } break; -case 58: -#line 483 "dcParser.yxx" +case 72: +#line 563 "dcParser.yxx" { // This is an inline switch definition. dc_file->add_thing_to_delete(yyvsp[0].u.dswitch); yyval.u.parameter = new DCSwitchParameter(yyvsp[0].u.dswitch); } break; -case 59: -#line 492 "dcParser.yxx" +case 73: +#line 572 "dcParser.yxx" { double_range.clear(); } break; -case 60: -#line 496 "dcParser.yxx" -{ - double_range.clear(); - if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { - yyerror("Overlapping range"); - } -} - break; -case 61: -#line 503 "dcParser.yxx" -{ - double_range.clear(); - if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { - yyerror("Overlapping range"); - } -} - break; -case 62: -#line 510 "dcParser.yxx" -{ - double_range.clear(); - if (yyvsp[0].u.real >= 0) { - yyerror("Syntax error"); - } else if (!double_range.add_range(yyvsp[-1].u.real, -yyvsp[0].u.real)) { - yyerror("Overlapping range"); - } -} - break; -case 63: -#line 519 "dcParser.yxx" -{ - if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { - yyerror("Overlapping range"); - } -} - break; -case 64: -#line 525 "dcParser.yxx" -{ - if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { - yyerror("Overlapping range"); - } -} - break; -case 65: -#line 531 "dcParser.yxx" -{ - if (yyvsp[0].u.real >= 0) { - yyerror("Syntax error"); - } else if (!double_range.add_range(yyvsp[-1].u.real, -yyvsp[0].u.real)) { - yyerror("Overlapping range"); - } -} - break; -case 66: -#line 542 "dcParser.yxx" -{ - uint_range.clear(); -} - break; -case 67: -#line 546 "dcParser.yxx" -{ - uint_range.clear(); - if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { - yyerror("Overlapping range"); - } -} - break; -case 68: -#line 553 "dcParser.yxx" -{ - uint_range.clear(); - if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { - yyerror("Overlapping range"); - } -} - break; -case 69: -#line 560 "dcParser.yxx" -{ - if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { - yyerror("Overlapping range"); - } -} - break; -case 70: -#line 566 "dcParser.yxx" -{ - if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { - yyerror("Overlapping range"); - } -} - break; -case 72: +case 74: #line 576 "dcParser.yxx" +{ + double_range.clear(); + if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { + yyerror("Overlapping range"); + } +} + break; +case 75: +#line 583 "dcParser.yxx" +{ + double_range.clear(); + if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { + yyerror("Overlapping range"); + } +} + break; +case 76: +#line 590 "dcParser.yxx" +{ + double_range.clear(); + if (yyvsp[0].u.real >= 0) { + yyerror("Syntax error"); + } else if (!double_range.add_range(yyvsp[-1].u.real, -yyvsp[0].u.real)) { + yyerror("Overlapping range"); + } +} + break; +case 77: +#line 599 "dcParser.yxx" +{ + if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { + yyerror("Overlapping range"); + } +} + break; +case 78: +#line 605 "dcParser.yxx" +{ + if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { + yyerror("Overlapping range"); + } +} + break; +case 79: +#line 611 "dcParser.yxx" +{ + if (yyvsp[0].u.real >= 0) { + yyerror("Syntax error"); + } else if (!double_range.add_range(yyvsp[-1].u.real, -yyvsp[0].u.real)) { + yyerror("Overlapping range"); + } +} + break; +case 80: +#line 622 "dcParser.yxx" +{ + uint_range.clear(); +} + break; +case 81: +#line 626 "dcParser.yxx" +{ + uint_range.clear(); + if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { + yyerror("Overlapping range"); + } +} + break; +case 82: +#line 633 "dcParser.yxx" +{ + uint_range.clear(); + if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { + yyerror("Overlapping range"); + } +} + break; +case 83: +#line 640 "dcParser.yxx" +{ + if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { + yyerror("Overlapping range"); + } +} + break; +case 84: +#line 646 "dcParser.yxx" +{ + if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { + yyerror("Overlapping range"); + } +} + break; +case 86: +#line 656 "dcParser.yxx" { yyval.u.parameter = new DCArrayParameter(yyvsp[-3].u.parameter, uint_range); } break; -case 73: -#line 583 "dcParser.yxx" +case 87: +#line 663 "dcParser.yxx" { current_parameter->set_name(yyvsp[0].str); yyval.u.parameter = current_parameter; } break; -case 74: -#line 588 "dcParser.yxx" +case 88: +#line 668 "dcParser.yxx" { if (yyvsp[0].u.s_uint == 0) { yyerror("Invalid divisor."); @@ -1636,14 +1723,14 @@ case 74: } } break; -case 75: -#line 602 "dcParser.yxx" +case 89: +#line 682 "dcParser.yxx" { yyval.u.parameter = new DCArrayParameter(yyvsp[-3].u.parameter, uint_range); } break; -case 76: -#line 609 "dcParser.yxx" +case 90: +#line 689 "dcParser.yxx" { if (yyvsp[0].str.length() != 1) { yyerror("Single character required."); @@ -1653,8 +1740,8 @@ case 76: } } break; -case 78: -#line 622 "dcParser.yxx" +case 92: +#line 702 "dcParser.yxx" { yyval.u.s_uint = (unsigned int)yyvsp[0].u.uint64; if (yyval.u.s_uint != yyvsp[0].u.uint64) { @@ -1663,20 +1750,20 @@ case 78: } } break; -case 81: -#line 641 "dcParser.yxx" +case 95: +#line 721 "dcParser.yxx" { yyval.u.real = (double)yyvsp[0].u.uint64; } break; -case 82: -#line 645 "dcParser.yxx" +case 96: +#line 725 "dcParser.yxx" { yyval.u.real = (double)yyvsp[0].u.int64; } break; -case 84: -#line 653 "dcParser.yxx" +case 98: +#line 733 "dcParser.yxx" { if (yyvsp[0].str.length() != 1) { yyerror("Single character required."); @@ -1686,298 +1773,298 @@ case 84: } } break; -case 86: -#line 667 "dcParser.yxx" +case 100: +#line 747 "dcParser.yxx" { current_packer->pack_int64(yyvsp[0].u.int64); } break; -case 87: -#line 671 "dcParser.yxx" +case 101: +#line 751 "dcParser.yxx" { current_packer->pack_uint64(yyvsp[0].u.uint64); } break; -case 88: -#line 675 "dcParser.yxx" +case 102: +#line 755 "dcParser.yxx" { current_packer->pack_double(yyvsp[0].u.real); } break; -case 89: -#line 679 "dcParser.yxx" +case 103: +#line 759 "dcParser.yxx" { current_packer->pack_string(yyvsp[0].str); } break; -case 90: -#line 683 "dcParser.yxx" +case 104: +#line 763 "dcParser.yxx" { current_packer->pack_literal_value(yyvsp[0].str); } break; -case 91: -#line 687 "dcParser.yxx" +case 105: +#line 767 "dcParser.yxx" { current_packer->push(); } break; -case 92: -#line 691 "dcParser.yxx" +case 106: +#line 771 "dcParser.yxx" { current_packer->pop(); } break; -case 93: -#line 695 "dcParser.yxx" +case 107: +#line 775 "dcParser.yxx" { current_packer->push(); } break; -case 94: -#line 699 "dcParser.yxx" +case 108: +#line 779 "dcParser.yxx" { current_packer->pop(); } break; -case 95: -#line 703 "dcParser.yxx" +case 109: +#line 783 "dcParser.yxx" { current_packer->push(); } break; -case 96: -#line 707 "dcParser.yxx" +case 110: +#line 787 "dcParser.yxx" { current_packer->pop(); } break; -case 97: -#line 711 "dcParser.yxx" +case 111: +#line 791 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_int64(yyvsp[-2].u.int64); } } break; -case 98: -#line 717 "dcParser.yxx" +case 112: +#line 797 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_uint64(yyvsp[-2].u.uint64); } } break; -case 99: -#line 723 "dcParser.yxx" +case 113: +#line 803 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_double(yyvsp[-2].u.real); } } break; -case 100: -#line 729 "dcParser.yxx" +case 114: +#line 809 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_literal_value(yyvsp[-2].str); } } break; -case 107: -#line 753 "dcParser.yxx" +case 121: +#line 833 "dcParser.yxx" { yyval.u.subatomic = ST_int8; } break; -case 108: -#line 757 "dcParser.yxx" +case 122: +#line 837 "dcParser.yxx" { yyval.u.subatomic = ST_int16; } break; -case 109: -#line 761 "dcParser.yxx" +case 123: +#line 841 "dcParser.yxx" { yyval.u.subatomic = ST_int32; } break; -case 110: -#line 765 "dcParser.yxx" +case 124: +#line 845 "dcParser.yxx" { yyval.u.subatomic = ST_int64; } break; -case 111: -#line 769 "dcParser.yxx" +case 125: +#line 849 "dcParser.yxx" { yyval.u.subatomic = ST_uint8; } break; -case 112: -#line 773 "dcParser.yxx" +case 126: +#line 853 "dcParser.yxx" { yyval.u.subatomic = ST_uint16; } break; -case 113: -#line 777 "dcParser.yxx" +case 127: +#line 857 "dcParser.yxx" { yyval.u.subatomic = ST_uint32; } break; -case 114: -#line 781 "dcParser.yxx" +case 128: +#line 861 "dcParser.yxx" { yyval.u.subatomic = ST_uint64; } break; -case 115: -#line 785 "dcParser.yxx" +case 129: +#line 865 "dcParser.yxx" { yyval.u.subatomic = ST_float64; } break; -case 116: -#line 789 "dcParser.yxx" +case 130: +#line 869 "dcParser.yxx" { yyval.u.subatomic = ST_string; } break; -case 117: -#line 793 "dcParser.yxx" +case 131: +#line 873 "dcParser.yxx" { yyval.u.subatomic = ST_blob; } break; -case 118: -#line 797 "dcParser.yxx" +case 132: +#line 877 "dcParser.yxx" { yyval.u.subatomic = ST_blob32; } break; -case 119: -#line 801 "dcParser.yxx" +case 133: +#line 881 "dcParser.yxx" { yyval.u.subatomic = ST_int8array; } break; -case 120: -#line 805 "dcParser.yxx" +case 134: +#line 885 "dcParser.yxx" { yyval.u.subatomic = ST_int16array; } break; -case 121: -#line 809 "dcParser.yxx" +case 135: +#line 889 "dcParser.yxx" { yyval.u.subatomic = ST_int32array; } break; -case 122: -#line 813 "dcParser.yxx" +case 136: +#line 893 "dcParser.yxx" { yyval.u.subatomic = ST_uint8array; } break; -case 123: -#line 817 "dcParser.yxx" +case 137: +#line 897 "dcParser.yxx" { yyval.u.subatomic = ST_uint16array; } break; -case 124: -#line 821 "dcParser.yxx" +case 138: +#line 901 "dcParser.yxx" { yyval.u.subatomic = ST_uint32array; } break; -case 125: -#line 825 "dcParser.yxx" +case 139: +#line 905 "dcParser.yxx" { yyval.u.subatomic = ST_uint32uint8array; } break; -case 126: -#line 829 "dcParser.yxx" +case 140: +#line 909 "dcParser.yxx" { yyval.u.subatomic = ST_char; } break; -case 127: -#line 836 "dcParser.yxx" +case 141: +#line 916 "dcParser.yxx" { yyval.u.s_int = 0; } break; -case 128: -#line 840 "dcParser.yxx" +case 142: +#line 920 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_required; } break; -case 129: -#line 844 "dcParser.yxx" +case 143: +#line 924 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_broadcast; } break; -case 130: -#line 848 "dcParser.yxx" +case 144: +#line 928 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_p2p; } break; -case 131: -#line 852 "dcParser.yxx" +case 145: +#line 932 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_ram; } break; -case 132: -#line 856 "dcParser.yxx" +case 146: +#line 936 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_db; } break; -case 133: -#line 860 "dcParser.yxx" +case 147: +#line 940 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_clsend; } break; -case 134: -#line 864 "dcParser.yxx" +case 148: +#line 944 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_clrecv; } break; -case 135: -#line 868 "dcParser.yxx" +case 149: +#line 948 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_ownsend; } break; -case 136: -#line 872 "dcParser.yxx" +case 150: +#line 952 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_airecv; } break; -case 137: -#line 879 "dcParser.yxx" +case 151: +#line 959 "dcParser.yxx" { current_molecular = new DCMolecularField(yyvsp[-1].str); } break; -case 138: -#line 883 "dcParser.yxx" +case 152: +#line 963 "dcParser.yxx" { yyval.u.field = current_molecular; } break; -case 139: -#line 890 "dcParser.yxx" +case 153: +#line 970 "dcParser.yxx" { DCField *field = current_class->get_field_by_name(yyvsp[0].str); yyval.u.atomic = (DCAtomicField *)NULL; @@ -1991,16 +2078,16 @@ case 139: } } break; -case 140: -#line 906 "dcParser.yxx" +case 154: +#line 986 "dcParser.yxx" { if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { current_molecular->add_atomic(yyvsp[0].u.atomic); } } break; -case 141: -#line 912 "dcParser.yxx" +case 155: +#line 992 "dcParser.yxx" { if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { current_molecular->add_atomic(yyvsp[0].u.atomic); @@ -2012,28 +2099,28 @@ case 141: } } break; -case 142: -#line 926 "dcParser.yxx" +case 156: +#line 1006 "dcParser.yxx" { yyval.str = ""; } break; -case 144: -#line 934 "dcParser.yxx" +case 158: +#line 1014 "dcParser.yxx" { yyval.u.dswitch = current_switch; current_switch = new DCSwitch(yyvsp[-4].str, yyvsp[-2].u.parameter); } break; -case 145: -#line 939 "dcParser.yxx" +case 159: +#line 1019 "dcParser.yxx" { yyval.u.dswitch = current_switch; current_switch = (DCSwitch *)yyvsp[-2].u.parameter; } break; -case 149: -#line 951 "dcParser.yxx" +case 163: +#line 1031 "dcParser.yxx" { if (current_switch->get_num_cases() == 0) { yyerror("case declaration required before first element"); @@ -2042,16 +2129,16 @@ case 149: } } break; -case 150: -#line 962 "dcParser.yxx" +case 164: +#line 1042 "dcParser.yxx" { current_packer = &default_packer; current_packer->clear_data(); current_packer->begin_pack(current_switch->get_key_parameter()); } break; -case 151: -#line 968 "dcParser.yxx" +case 165: +#line 1048 "dcParser.yxx" { if (!current_packer->end_pack()) { yyerror("Invalid value for switch parameter"); @@ -2060,14 +2147,14 @@ case 151: } } break; -case 152: -#line 979 "dcParser.yxx" +case 166: +#line 1059 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.parameter; } break; -case 153: -#line 983 "dcParser.yxx" +case 167: +#line 1063 "dcParser.yxx" { yyval.u.field = yyvsp[0].u.parameter; } @@ -2305,4 +2392,4 @@ yyreturn: #endif return yyresult; } -#line 991 "dcParser.yxx" +#line 1071 "dcParser.yxx" diff --git a/direct/src/dcparser/dcParser.yxx b/direct/src/dcparser/dcParser.yxx index 9b2dce5957..84dae1fc20 100644 --- a/direct/src/dcparser/dcParser.yxx +++ b/direct/src/dcparser/dcParser.yxx @@ -115,13 +115,16 @@ dc_cleanup_parser() { %token START_DC %token START_PARAMETER_VALUE -%type kw_struct_or_kw_dclass -%type dclass_name -%type dclass -%type switch %type atomic_name %type server_flags +%type dclass_or_struct +%type dclass_name +%type dclass %type dclass_field +%type struct_name +%type struct +%type struct_field +%type switch %type switch_field %type atomic_field %type molecular_field @@ -152,7 +155,7 @@ grammar: dc: empty | dc ';' - | dc dclass + | dc dclass_or_struct { if (!dc_file->add_class($2)) { DCClass *old_class = dc_file->get_class_by_name($2->get_name()); @@ -173,44 +176,6 @@ dc: | dc typedef_decl ; -dclass: - kw_struct_or_kw_dclass optional_name -{ - $$ = current_class; - current_class = new DCClass($2, $1, false); -} - dclass_derivation '{' dclass_fields '}' -{ - $$ = current_class; - current_class = $3; -} - ; - -kw_struct_or_kw_dclass: - KW_STRUCT -{ - $$ = true; -} - | KW_DCLASS -{ - $$ = false; -} - ; - -dclass_name: - IDENTIFIER -{ - DCClass *dclass = dc_file->get_class_by_name($1); - if (dclass == (DCClass *)NULL) { - // Create a bogus class as a forward reference. - dclass = new DCClass($1, false, true); - dc_file->add_class(dclass); - } - - $$ = dclass; -} - ; - slash_identifier: IDENTIFIER | slash_identifier '/' IDENTIFIER @@ -274,19 +239,54 @@ typedef_decl: } ; -dclass_derivation: - empty - | ':' base_list +dclass_or_struct: + dclass + | struct + ; + +dclass: + KW_DCLASS optional_name +{ + $$ = current_class; + current_class = new DCClass($2, false, false); +} + dclass_derivation '{' dclass_fields '}' +{ + $$ = current_class; + current_class = $3; +} ; -base_list: +dclass_name: + IDENTIFIER +{ + DCClass *dclass = dc_file->get_class_by_name($1); + if (dclass == (DCClass *)NULL) { + // Create a bogus class as a forward reference. + dclass = new DCClass($1, false, true); + dc_file->add_class(dclass); + } + if (dclass->is_struct()) { + yyerror("struct name not allowed"); + } + + $$ = dclass; +} + ; + +dclass_derivation: + empty + | ':' dclass_base_list + ; + +dclass_base_list: dclass_name { if ($1 != (DCClass *)NULL) { current_class->add_parent($1); } } - | base_list ',' dclass_name + | dclass_base_list ',' dclass_name { if ($3 != (DCClass *)NULL) { current_class->add_parent($3); @@ -306,7 +306,11 @@ dclass_fields: ; dclass_field: - atomic_field + atomic_field server_flags +{ + $$ = $1; + $$->set_flags($2); +} | molecular_field | unnamed_parameter server_flags ';' { @@ -320,17 +324,90 @@ dclass_field: } ; +struct: + KW_STRUCT optional_name +{ + $$ = current_class; + current_class = new DCClass($2, true, false); +} + struct_derivation '{' struct_fields '}' +{ + $$ = current_class; + current_class = $3; +} + ; + +struct_name: + IDENTIFIER +{ + DCClass *dstruct = dc_file->get_class_by_name($1); + if (dstruct == (DCClass *)NULL) { + // Create a bogus class as a forward reference. + dstruct = new DCClass($1, false, true); + dc_file->add_class(dstruct); + } + if (!dstruct->is_struct()) { + yyerror("struct name required"); + } + + $$ = dstruct; +} + ; + +struct_derivation: + empty + | ':' struct_base_list + ; + +struct_base_list: + struct_name +{ + if ($1 != (DCClass *)NULL) { + current_class->add_parent($1); + } +} + | struct_base_list ',' struct_name +{ + if ($3 != (DCClass *)NULL) { + current_class->add_parent($3); + } +} + ; + +struct_fields: + empty + | struct_fields ';' + | struct_fields struct_field +{ + if (!current_class->add_field($2)) { + yyerror("Duplicate field name: " + $2->get_name()); + } +} + ; + +struct_field: + atomic_field + | molecular_field + | unnamed_parameter ';' +{ + $$ = $1; +} + | named_parameter +{ + $$ = $1; +} + ; + atomic_field: IDENTIFIER '(' { $$ = current_atomic; current_atomic = new DCAtomicField($1); } - parameter_list ')' server_flags + parameter_list ')' { $$ = current_atomic; current_atomic = $3; - $$->set_flags($6); } ; @@ -454,6 +531,9 @@ type_name: // Maybe it's a class name. DCClass *dclass = dc_file->get_class_by_name($1); if (dclass != (DCClass *)NULL) { + if (!dclass->is_struct()) { + yyerror("cannot embed a dclass object within a message; use a struct"); + } // Create an implicit typedef for this. dtypedef = new DCTypedef(new DCClassParameter(dclass), true); } else { @@ -473,9 +553,9 @@ type_name: $$ = dtypedef->make_new_parameter(); } - | dclass + | struct { - // This is an inline class definition. + // This is an inline struct definition. dc_file->add_thing_to_delete($1); $$ = new DCClassParameter($1); }