diff --git a/cpp/src/Slice/Grammar.cpp b/cpp/src/Slice/Grammar.cpp index 2e19a8e3c48..461bc26f82c 100644 --- a/cpp/src/Slice/Grammar.cpp +++ b/cpp/src/Slice/Grammar.cpp @@ -283,54 +283,54 @@ enum yysymbol_kind_t YYSYMBOL_type_id = 70, /* type_id */ YYSYMBOL_optional = 71, /* optional */ YYSYMBOL_optional_type_id = 72, /* optional_type_id */ - YYSYMBOL_struct_id = 73, /* struct_id */ - YYSYMBOL_struct_decl = 74, /* struct_decl */ - YYSYMBOL_struct_def = 75, /* struct_def */ - YYSYMBOL_76_4 = 76, /* @4 */ - YYSYMBOL_class_name = 77, /* class_name */ - YYSYMBOL_class_id = 78, /* class_id */ - YYSYMBOL_class_decl = 79, /* class_decl */ - YYSYMBOL_class_def = 80, /* class_def */ - YYSYMBOL_81_5 = 81, /* @5 */ - YYSYMBOL_class_extends = 82, /* class_extends */ - YYSYMBOL_extends = 83, /* extends */ - YYSYMBOL_data_members = 84, /* data_members */ - YYSYMBOL_data_member = 85, /* data_member */ - YYSYMBOL_return_type = 86, /* return_type */ - YYSYMBOL_idempotent_modifier = 87, /* idempotent_modifier */ - YYSYMBOL_operation_preamble = 88, /* operation_preamble */ - YYSYMBOL_operation = 89, /* operation */ - YYSYMBOL_90_6 = 90, /* @6 */ - YYSYMBOL_91_7 = 91, /* @7 */ - YYSYMBOL_interface_id = 92, /* interface_id */ - YYSYMBOL_interface_decl = 93, /* interface_decl */ - YYSYMBOL_interface_def = 94, /* interface_def */ - YYSYMBOL_95_8 = 95, /* @8 */ - YYSYMBOL_interface_list = 96, /* interface_list */ - YYSYMBOL_interface_extends = 97, /* interface_extends */ - YYSYMBOL_operations = 98, /* operations */ - YYSYMBOL_exception_list = 99, /* exception_list */ - YYSYMBOL_exception = 100, /* exception */ - YYSYMBOL_sequence_def = 101, /* sequence_def */ - YYSYMBOL_dictionary_def = 102, /* dictionary_def */ - YYSYMBOL_enum_def = 103, /* enum_def */ - YYSYMBOL_104_9 = 104, /* @9 */ - YYSYMBOL_enumerators = 105, /* enumerators */ - YYSYMBOL_enumerator_list = 106, /* enumerator_list */ - YYSYMBOL_enumerator = 107, /* enumerator */ - YYSYMBOL_parameter = 108, /* parameter */ - YYSYMBOL_parameters = 109, /* parameters */ - YYSYMBOL_parameter_list = 110, /* parameter_list */ - YYSYMBOL_throws = 111, /* throws */ - YYSYMBOL_scoped_name = 112, /* scoped_name */ - YYSYMBOL_builtin = 113, /* builtin */ - YYSYMBOL_type = 114, /* type */ - YYSYMBOL_integer_constant = 115, /* integer_constant */ - YYSYMBOL_string_literal = 116, /* string_literal */ - YYSYMBOL_metadata_list = 117, /* metadata_list */ - YYSYMBOL_const_initializer = 118, /* const_initializer */ - YYSYMBOL_const_def = 119, /* const_def */ - YYSYMBOL_definition_name = 120, /* definition_name */ + YYSYMBOL_struct_decl = 73, /* struct_decl */ + YYSYMBOL_struct_def = 74, /* struct_def */ + YYSYMBOL_75_4 = 75, /* @4 */ + YYSYMBOL_class_name = 76, /* class_name */ + YYSYMBOL_class_id = 77, /* class_id */ + YYSYMBOL_class_decl = 78, /* class_decl */ + YYSYMBOL_class_def = 79, /* class_def */ + YYSYMBOL_80_5 = 80, /* @5 */ + YYSYMBOL_class_extends = 81, /* class_extends */ + YYSYMBOL_extends = 82, /* extends */ + YYSYMBOL_data_members = 83, /* data_members */ + YYSYMBOL_data_member = 84, /* data_member */ + YYSYMBOL_return_type = 85, /* return_type */ + YYSYMBOL_idempotent_modifier = 86, /* idempotent_modifier */ + YYSYMBOL_operation_preamble = 87, /* operation_preamble */ + YYSYMBOL_operation = 88, /* operation */ + YYSYMBOL_89_6 = 89, /* @6 */ + YYSYMBOL_90_7 = 90, /* @7 */ + YYSYMBOL_interface_id = 91, /* interface_id */ + YYSYMBOL_interface_decl = 92, /* interface_decl */ + YYSYMBOL_interface_def = 93, /* interface_def */ + YYSYMBOL_94_8 = 94, /* @8 */ + YYSYMBOL_interface_list = 95, /* interface_list */ + YYSYMBOL_interface_extends = 96, /* interface_extends */ + YYSYMBOL_operations = 97, /* operations */ + YYSYMBOL_exception_list = 98, /* exception_list */ + YYSYMBOL_exception = 99, /* exception */ + YYSYMBOL_sequence_def = 100, /* sequence_def */ + YYSYMBOL_dictionary_def = 101, /* dictionary_def */ + YYSYMBOL_enum_def = 102, /* enum_def */ + YYSYMBOL_103_9 = 103, /* @9 */ + YYSYMBOL_enumerators = 104, /* enumerators */ + YYSYMBOL_enumerator_list = 105, /* enumerator_list */ + YYSYMBOL_enumerator = 106, /* enumerator */ + YYSYMBOL_parameter = 107, /* parameter */ + YYSYMBOL_parameters = 108, /* parameters */ + YYSYMBOL_parameter_list = 109, /* parameter_list */ + YYSYMBOL_throws = 110, /* throws */ + YYSYMBOL_scoped_name = 111, /* scoped_name */ + YYSYMBOL_builtin = 112, /* builtin */ + YYSYMBOL_type = 113, /* type */ + YYSYMBOL_integer_constant = 114, /* integer_constant */ + YYSYMBOL_string_literal = 115, /* string_literal */ + YYSYMBOL_metadata_list = 116, /* metadata_list */ + YYSYMBOL_const_initializer = 117, /* const_initializer */ + YYSYMBOL_const_def = 118, /* const_def */ + YYSYMBOL_definition_name = 119, /* definition_name */ + YYSYMBOL_definition_name_open = 120, /* definition_name_open */ YYSYMBOL_keyword = 121 /* keyword */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -672,16 +672,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 622 +#define YYLAST 604 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 53 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 69 /* YYNRULES -- Number of rules. */ -#define YYNRULES 184 +#define YYNRULES 183 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 274 +#define YYNSTATES 273 /* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 297 @@ -737,22 +737,22 @@ static const yytype_int16 yyrline[] = 0, 202, 202, 210, 213, 221, 225, 229, 239, 243, 247, 257, 260, 269, 273, 285, 293, 302, 310, 314, 318, 322, 326, 330, 334, 338, 342, 346, 350, 354, - 358, 362, 372, 371, 402, 401, 485, 489, 500, 511, - 510, 536, 544, 553, 564, 577, 583, 594, 611, 624, - 628, 639, 650, 649, 688, 692, 703, 723, 735, 748, - 747, 781, 809, 818, 821, 829, 838, 841, 845, 853, - 883, 914, 936, 962, 977, 983, 993, 997, 1006, 1033, - 1066, 1065, 1097, 1096, 1119, 1123, 1134, 1148, 1147, 1181, - 1191, 1201, 1206, 1216, 1220, 1229, 1238, 1241, 1245, 1253, - 1260, 1272, 1284, 1295, 1308, 1324, 1323, 1348, 1349, 1353, - 1362, 1374, 1391, 1397, 1413, 1425, 1438, 1452, 1465, 1473, - 1487, 1488, 1494, 1495, 1501, 1505, 1514, 1517, 1525, 1526, - 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1539, 1543, - 1548, 1553, 1563, 1567, 1652, 1658, 1666, 1676, 1691, 1700, - 1709, 1744, 1751, 1758, 1770, 1784, 1789, 1797, 1809, 1810, - 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, - 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, - 1831, 1832, 1833, 1834, 1835 + 358, 362, 372, 371, 389, 388, 453, 457, 468, 479, + 478, 504, 512, 521, 532, 545, 551, 562, 579, 592, + 603, 602, 629, 633, 644, 664, 676, 689, 688, 722, + 750, 759, 762, 770, 779, 782, 786, 794, 824, 855, + 877, 903, 918, 924, 934, 938, 947, 977, 976, 1008, + 1007, 1030, 1034, 1045, 1059, 1058, 1092, 1102, 1112, 1117, + 1127, 1131, 1140, 1149, 1152, 1156, 1164, 1171, 1183, 1195, + 1206, 1219, 1235, 1234, 1259, 1260, 1264, 1273, 1285, 1302, + 1308, 1324, 1336, 1349, 1363, 1376, 1384, 1398, 1399, 1405, + 1406, 1412, 1416, 1425, 1428, 1436, 1437, 1438, 1439, 1440, + 1441, 1442, 1443, 1444, 1445, 1450, 1454, 1459, 1464, 1474, + 1478, 1563, 1569, 1577, 1587, 1602, 1611, 1620, 1655, 1662, + 1669, 1681, 1695, 1700, 1708, 1720, 1725, 1738, 1739, 1740, + 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, + 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, + 1761, 1762, 1763, 1764 }; #endif @@ -785,28 +785,29 @@ yysymbol_name (yysymbol_kind_t yysymbol) "metadata", "metadata_directives", "definitions", "definition", "module_def", "@1", "@2", "exception_id", "exception_decl", "exception_def", "@3", "exception_extends", "type_id", "optional", - "optional_type_id", "struct_id", "struct_decl", "struct_def", "@4", - "class_name", "class_id", "class_decl", "class_def", "@5", - "class_extends", "extends", "data_members", "data_member", "return_type", - "idempotent_modifier", "operation_preamble", "operation", "@6", "@7", - "interface_id", "interface_decl", "interface_def", "@8", - "interface_list", "interface_extends", "operations", "exception_list", - "exception", "sequence_def", "dictionary_def", "enum_def", "@9", - "enumerators", "enumerator_list", "enumerator", "parameter", - "parameters", "parameter_list", "throws", "scoped_name", "builtin", - "type", "integer_constant", "string_literal", "metadata_list", - "const_initializer", "const_def", "definition_name", "keyword", YY_NULLPTR + "optional_type_id", "struct_decl", "struct_def", "@4", "class_name", + "class_id", "class_decl", "class_def", "@5", "class_extends", "extends", + "data_members", "data_member", "return_type", "idempotent_modifier", + "operation_preamble", "operation", "@6", "@7", "interface_id", + "interface_decl", "interface_def", "@8", "interface_list", + "interface_extends", "operations", "exception_list", "exception", + "sequence_def", "dictionary_def", "enum_def", "@9", "enumerators", + "enumerator_list", "enumerator", "parameter", "parameters", + "parameter_list", "throws", "scoped_name", "builtin", "type", + "integer_constant", "string_literal", "metadata_list", + "const_initializer", "const_def", "definition_name", + "definition_name_open", "keyword", YY_NULLPTR }; return yy_sname[yysymbol]; } #endif -#define YYPACT_NINF (-225) +#define YYPACT_NINF (-206) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF (-122) +#define YYTABLE_NINF (-119) #define yytable_value_is_error(Yyn) \ 0 @@ -815,34 +816,34 @@ yysymbol_name (yysymbol_kind_t yysymbol) STATE-NUM. */ static const yytype_int16 yypact[] = { - -225, 20, 12, -225, 18, 14, -225, -225, 592, 6, - 7, -6, -225, -225, -18, 23, -225, 36, 30, 46, - 282, 351, 382, 413, 8, 25, 444, 6, -225, 38, - 9, 44, 38, 54, 60, 38, 63, 10, 65, 38, - 15, 71, 38, 82, 83, 38, 84, -225, -225, -225, - -225, -6, -225, -225, -225, -225, -225, -225, -225, -225, - -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, - -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, - -225, -225, -225, -225, -225, 126, -225, -225, -225, -225, - -225, -225, -225, 6, 6, -225, -225, -225, 588, -225, - -225, -225, -225, -225, 59, -225, -225, 87, -225, -225, - -225, 59, -225, -225, 76, -225, -225, -225, -225, -225, - -225, -225, -225, 88, 96, -225, -225, -225, -225, 97, - 588, 588, 105, -225, -225, -225, -225, -225, -225, -225, - -225, 100, -225, 106, -225, 444, 117, -225, 239, 121, - -225, -225, -225, 113, -225, 122, -225, -225, -225, 116, - 120, -12, -225, -225, 123, 239, 127, 553, 128, 239, - 59, 101, 102, 118, 444, 6, 475, 132, 130, 197, - 135, 239, -225, 55, -225, 588, 124, 138, 506, -225, - 137, -225, 140, 157, 142, -225, -225, -225, 588, 141, - -225, -225, -225, 1, -225, -225, -225, -225, -225, -225, - -225, -225, -225, -225, 139, -225, 155, 197, 239, -225, - -225, -225, 101, -225, 526, 49, 147, -225, 143, 126, - 475, -225, -225, -225, -225, -225, 588, -11, -225, 146, - 180, 180, -225, -225, 158, 156, 506, 101, 444, -225, - -225, -225, -225, -225, -225, -225, -225, -225, 180, -225, - -225, -225, 194, 194, -225, 319, -225, -225, 162, -225, - -225, -225, 319, -225 + -206, 17, 20, -206, 33, 26, -206, -206, 84, -11, + 32, -9, -206, -206, -14, 23, -206, -24, 29, 336, + 298, 400, 431, 462, 24, 51, 462, -11, -206, 61, + 18, 92, 61, 99, 61, 103, 3, 106, 61, 37, + 117, 61, 118, 125, 61, 129, -206, -206, -206, -206, + -9, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, 49, -206, + -206, -206, -206, -206, 83, -11, -11, -206, 570, -206, + -206, -206, -206, -206, 87, -206, -206, -206, -206, -206, + 87, -206, -206, 44, -206, -206, -206, -206, -206, -206, + -206, -206, 95, 130, -206, -206, -206, -206, 108, 134, + 570, 570, 135, -206, -206, -206, -206, -206, -206, -206, + -206, 121, -206, 128, -206, 462, 137, -206, 138, -206, + -206, -206, 136, -206, 140, -206, -206, -206, 255, 126, + 139, 88, -206, -206, 141, 255, 255, 87, 220, 65, + 110, 143, 543, 142, 462, -11, 493, 146, 154, 133, + 147, 160, -206, 163, 182, 170, -206, -206, 255, -206, + -15, -206, 570, 168, 174, 524, -206, -206, 570, 171, + -206, -206, -206, 91, -206, -206, -206, -206, -206, -206, + -206, -206, -206, 220, -206, 179, 25, 175, -206, -206, + -206, 176, -206, 191, 133, 255, -206, -206, 177, 49, + 493, -206, -206, 570, 111, -206, 180, 96, 96, -206, + -206, 181, 197, 524, 220, -206, -206, -206, 462, -206, + -206, -206, -206, -206, -206, -206, -206, 96, -206, -206, + -206, 212, 212, -206, 368, -206, -206, 201, -206, -206, + -206, 368, -206 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -851,57 +852,57 @@ static const yytype_int16 yypact[] = static const yytype_uint8 yydefact[] = { 17, 0, 12, 1, 0, 0, 15, 13, 0, 11, - 0, 145, 10, 147, 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 157, 12, 16, 4, - 38, 0, 4, 51, 0, 4, 57, 62, 0, 4, - 86, 0, 4, 0, 0, 4, 0, 14, 9, 144, - 8, 0, 6, 5, 31, 32, 34, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 54, 0, 55, 84, 85, 36, - 37, 49, 50, 12, 12, 155, 105, 156, 0, 3, - 18, 63, 64, 39, 0, 23, 24, 0, 25, 26, - 59, 0, 19, 20, 0, 87, 21, 22, 27, 28, - 29, 30, 146, 0, 0, 142, 126, 127, 143, 0, - 0, 0, 0, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 140, 139, 157, 0, 41, 0, 0, - 61, 91, 92, 93, 90, 0, 17, 17, 56, 0, - 0, 12, 138, 141, 0, 0, 0, 0, 0, 0, - 0, 0, 12, 12, 157, 12, 0, 0, 107, 0, - 0, 0, 46, 0, 48, 0, 69, 67, 72, 53, - 0, 89, 0, 77, 0, 33, 35, 103, 0, 112, - 111, 114, 106, 12, 152, 153, 151, 148, 149, 150, - 154, 40, 66, 45, 0, 47, 0, 0, 0, 43, - 71, 60, 0, 76, 0, 0, 97, 88, 0, 0, - 0, 44, 70, 65, 96, 75, 0, 0, 74, 0, - 0, 0, 115, 122, 0, 120, 117, 0, 157, 113, - 110, 73, 78, 79, 82, 118, 119, 80, 0, 116, - 95, 104, 125, 125, 123, 0, 83, 81, 124, 100, - 101, 102, 0, 99 + 0, 142, 10, 144, 0, 0, 7, 0, 0, 154, + 0, 0, 0, 154, 0, 0, 154, 12, 16, 4, + 38, 0, 4, 0, 4, 55, 60, 0, 4, 83, + 0, 4, 0, 0, 4, 0, 14, 9, 141, 8, + 0, 6, 5, 31, 157, 158, 159, 160, 161, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 152, 34, 32, 153, 52, 155, 156, 0, 53, + 81, 82, 36, 37, 49, 12, 12, 102, 0, 3, + 18, 61, 62, 39, 0, 23, 24, 25, 26, 57, + 0, 19, 20, 0, 84, 21, 22, 27, 28, 29, + 30, 143, 0, 0, 139, 123, 124, 140, 0, 0, + 0, 0, 0, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 137, 136, 154, 0, 41, 0, 59, + 88, 89, 90, 87, 0, 17, 17, 54, 0, 0, + 0, 12, 135, 138, 0, 0, 0, 0, 0, 12, + 12, 0, 0, 0, 154, 12, 0, 0, 104, 0, + 0, 0, 86, 0, 75, 0, 35, 33, 0, 46, + 0, 48, 0, 67, 65, 70, 51, 100, 0, 109, + 108, 111, 103, 12, 149, 150, 148, 145, 146, 147, + 151, 40, 58, 0, 74, 0, 0, 94, 85, 64, + 45, 0, 47, 0, 0, 0, 43, 69, 0, 0, + 0, 93, 73, 0, 0, 72, 0, 0, 0, 112, + 119, 0, 117, 114, 0, 44, 68, 63, 154, 110, + 107, 71, 76, 79, 115, 116, 77, 0, 113, 92, + 101, 122, 122, 120, 0, 80, 78, 121, 97, 98, + 99, 0, 96 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -225, -225, 109, -225, -5, 3, -225, -44, -225, -225, - -225, -225, -225, -225, -225, -225, -225, 27, -8, 50, - -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, - 5, -155, -225, -225, -225, -225, -225, -225, -225, -225, - -225, -225, -225, -225, -225, -209, -225, -54, -225, -225, - -225, -225, -225, -225, 2, -224, -225, -225, -39, -79, - -225, -91, -174, 0, 214, 16, -225, -137, -20 + -206, -206, 100, -206, -5, 1, -206, -3, -206, -206, + -206, -206, -206, -206, -206, -206, -206, 38, 14, 85, + -206, -206, -206, -206, -206, -206, -206, -206, -206, 67, + -155, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -205, -206, -13, -206, -206, -206, + -206, -206, -206, 30, -162, -206, -206, 0, -81, -206, + -93, -178, 2, 254, 39, -206, -17, 34, -20 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - 0, 1, 100, 6, 7, 167, 9, 2, 28, 29, - 123, 124, 30, 31, 32, 146, 103, 184, 185, 242, - 33, 34, 35, 107, 36, 37, 38, 39, 149, 110, - 104, 168, 187, 237, 224, 225, 226, 263, 262, 40, - 41, 42, 155, 153, 115, 194, 268, 269, 43, 44, - 45, 132, 177, 178, 200, 243, 244, 245, 266, 143, - 144, 246, 129, 13, 14, 210, 46, 96, 97 + 0, 1, 100, 6, 7, 172, 9, 2, 28, 29, + 123, 122, 30, 31, 32, 146, 103, 191, 192, 239, + 33, 34, 129, 35, 36, 37, 38, 148, 109, 104, + 173, 194, 234, 215, 216, 217, 262, 261, 39, 40, + 41, 154, 152, 114, 185, 267, 268, 42, 43, 44, + 132, 177, 178, 200, 240, 241, 242, 265, 143, 144, + 243, 128, 13, 14, 210, 45, 83, 88, 84 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -909,109 +910,115 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 86, 88, 90, 92, 47, 8, 128, 145, 164, 214, - 180, 49, -2, 234, 190, 15, 255, 256, 50, 10, - 3, 101, 101, 4, 11, 147, 212, 101, 252, 253, - 98, 51, 150, -109, 264, 154, 4, 197, 260, 159, - 160, 4, 111, 48, 11, 114, -108, 4, 11, 5, - 239, 122, 16, -42, 12, 249, 102, 102, 93, -94, - 240, 52, 102, 233, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 54, 53, 94, 188, 182, 142, 55, - 56, 99, 126, 127, 4, 51, 125, 105, 126, 127, - 183, 191, 126, 127, 216, -121, 130, 131, -52, 151, - 209, 213, 192, 108, 128, 152, -58, 228, 112, 126, - 127, 261, 172, 173, 116, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, 118, 119, 121, -12, -12, - -12, 148, 156, 238, -12, -12, 4, 4, 209, 5, - 157, 106, -12, 158, 109, 251, -98, 195, 113, 161, - 128, 117, 162, 4, 120, 5, 201, 125, 163, 126, - 127, 165, 170, 196, 176, 169, 171, 174, 220, 175, - 181, 179, 217, 189, 193, 8, 8, 202, 198, 203, - 211, 218, 221, 222, 223, 231, 270, 227, 219, 229, - 247, 240, 254, 270, 248, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 257, 258, 230, 265, 182, 142, - 201, 272, 215, 126, 127, 4, 236, 186, 273, 17, - 241, 183, 204, 205, 267, 193, 259, 206, 207, 208, - 126, 127, 250, 232, 0, 241, 241, 0, 0, 0, - 166, 0, 0, 0, 0, 271, 0, 0, 0, 0, - 193, 0, 271, 241, -12, -12, -12, -12, -12, -12, - -12, -12, -12, 0, 0, 0, 0, -12, -12, 0, - 0, 0, -12, -12, 4, 0, 0, 0, 0, 0, - -12, 0, 0, 0, -68, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 0, 0, 0, 84, 0, 0, 0, 0, - 0, 85, 57, 58, 59, 60, 61, 62, 63, 64, + 89, 91, 93, 8, 46, 145, 94, 127, 231, 97, + 180, 181, 221, 48, 52, 101, 124, 3, 125, 126, + -2, 11, 49, 147, 4, 50, 236, 15, 98, 149, + 101, 220, 153, 219, 10, 50, 237, 159, 160, 259, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 101, + 102, 249, 121, 189, 142, 4, 11, 5, 125, 126, + 4, 51, -42, 11, 16, 102, 190, 150, 47, 12, + 247, -118, 53, 151, 95, 254, 255, 125, 126, 195, + 124, -91, 125, 126, 102, 18, 182, 19, 20, 21, + 22, 23, 24, 25, 26, 263, 130, 131, 209, 223, + 4, 96, 5, 110, 99, 228, 113, 237, 27, 127, + 186, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 125, 126, 235, 4, 189, 142, 4, -50, 164, 125, + 126, 4, 106, -106, 108, 105, -105, 190, 112, 155, + 251, 116, 107, 209, 119, 4, -56, 5, 127, 111, + 86, 87, 169, 170, 157, 187, 201, 197, 204, 205, + 115, 117, 176, 206, 207, 208, 125, 126, 118, 184, + 8, 8, 120, 162, 156, 227, 198, 174, 158, 161, + 163, 165, 166, 269, 168, 167, 188, 196, 175, 179, + 269, 202, 211, 232, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 203, 230, 212, 213, 189, 142, 214, + 201, 238, 125, 126, 184, 218, 224, 225, 244, 229, + 190, 183, 245, 258, 226, 264, 253, 256, 248, 233, + 222, 260, 238, 238, -12, -12, -12, -12, -12, -12, + -12, -12, -12, -12, 270, 184, 257, -12, -12, -12, + 271, 270, 238, -12, -12, 4, 171, 193, 272, 17, + 250, -12, 266, 246, 0, -95, 0, 0, 252, 0, + -12, -12, -12, -12, -12, -12, -12, -12, -12, 0, + 0, 0, 0, -12, -12, 0, 0, 0, -12, -12, + 4, 0, 0, 0, 0, 0, -12, 0, 0, 0, + -66, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, + 0, 85, 0, 0, 0, 0, 0, 86, 87, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 0, - 0, 0, 126, 127, 57, 58, 59, 60, 61, 62, + 75, 76, 77, 78, 79, 80, 0, 0, 0, 81, + 82, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 0, 0, 0, 87, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 0, 0, 0, 89, 57, 58, 59, 60, + 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, + 0, 125, 126, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 0, 0, 0, 91, 57, 58, 59, + 0, 0, 0, 90, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 0, 0, 0, 95, 57, 58, + 80, 0, 0, 0, 92, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 0, 0, 0, 199, 57, + 79, 80, 0, 0, 0, 81, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 0, 0, 0, 219, - 235, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 0, 0, 0, 0, 182, 142, 0, 0, 0, 126, - 127, 0, 0, 0, 0, 0, 0, 183, 133, 134, + 78, 79, 80, 0, 0, 0, 199, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 0, 0, 0, 226, 133, 134, 135, 136, 137, 138, 139, 140, 141, 0, 0, 0, - 0, 182, 142, 0, 0, 0, 126, 127, 0, 0, - 0, 0, 0, 18, 183, 19, 20, 21, 22, 23, - 24, 25, 26, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 0, 0, 0, 0, 27, 142, 0, 0, - 0, 126, 127 + 0, 189, 142, 0, 0, 0, 125, 126, 0, 0, + 0, 0, 0, 0, 190, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 0, 0, 0, 0, 0, 142, + 0, 0, 0, 125, 126 }; static const yytype_int16 yycheck[] = { - 20, 21, 22, 23, 9, 2, 85, 98, 145, 183, - 165, 11, 0, 222, 169, 1, 240, 241, 36, 1, - 0, 12, 12, 35, 30, 104, 181, 12, 39, 40, - 27, 49, 111, 45, 258, 114, 35, 174, 247, 130, - 131, 35, 37, 36, 30, 40, 45, 35, 30, 37, - 1, 51, 38, 44, 36, 229, 47, 47, 50, 44, - 11, 38, 47, 218, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 43, 38, 50, 167, 28, 29, 33, - 34, 43, 33, 34, 35, 49, 31, 43, 33, 34, - 41, 170, 33, 34, 185, 46, 93, 94, 44, 23, - 179, 46, 1, 43, 183, 29, 43, 198, 43, 33, - 34, 248, 156, 157, 43, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 43, 43, 43, 27, 28, - 29, 44, 44, 224, 33, 34, 35, 35, 217, 37, - 44, 32, 41, 46, 35, 236, 45, 45, 39, 44, - 229, 42, 52, 35, 45, 37, 176, 31, 52, 33, - 34, 44, 49, 45, 161, 44, 44, 51, 188, 49, - 43, 48, 48, 45, 171, 172, 173, 45, 175, 49, - 45, 43, 45, 43, 27, 46, 265, 45, 33, 48, - 43, 11, 46, 272, 51, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 46, 49, 203, 13, 28, 29, - 230, 49, 185, 33, 34, 35, 224, 167, 272, 5, - 225, 41, 25, 26, 263, 222, 246, 30, 31, 32, - 33, 34, 230, 217, -1, 240, 241, -1, -1, -1, - 1, -1, -1, -1, -1, 265, -1, -1, -1, -1, - 247, -1, 272, 258, 15, 16, 17, 18, 19, 20, - 21, 22, 23, -1, -1, -1, -1, 28, 29, -1, - -1, -1, 33, 34, 35, -1, -1, -1, -1, -1, - 41, -1, -1, -1, 45, 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, -1, -1, -1, 33, -1, -1, -1, -1, - -1, 39, 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, -1, - -1, -1, 33, 34, 3, 4, 5, 6, 7, 8, + 20, 21, 22, 2, 9, 98, 23, 88, 213, 26, + 165, 166, 190, 11, 38, 12, 31, 0, 33, 34, + 0, 30, 36, 104, 35, 49, 1, 1, 27, 110, + 12, 46, 113, 188, 1, 49, 11, 130, 131, 244, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 12, + 47, 229, 50, 28, 29, 35, 30, 37, 33, 34, + 35, 38, 44, 30, 38, 47, 41, 23, 36, 36, + 225, 46, 43, 29, 50, 237, 238, 33, 34, 172, + 31, 44, 33, 34, 47, 1, 167, 3, 4, 5, + 6, 7, 8, 9, 10, 257, 95, 96, 179, 192, + 35, 50, 37, 36, 43, 198, 39, 11, 24, 190, + 45, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 33, 34, 215, 35, 28, 29, 35, 44, 145, 33, + 34, 35, 32, 45, 34, 43, 45, 41, 38, 44, + 233, 41, 43, 224, 44, 35, 43, 37, 229, 43, + 39, 40, 155, 156, 46, 45, 176, 174, 25, 26, + 43, 43, 161, 30, 31, 32, 33, 34, 43, 168, + 169, 170, 43, 52, 44, 195, 175, 51, 44, 44, + 52, 44, 44, 264, 44, 49, 43, 45, 49, 48, + 271, 45, 45, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 49, 203, 45, 43, 28, 29, 27, + 230, 216, 33, 34, 213, 45, 48, 43, 43, 48, + 41, 1, 46, 243, 33, 13, 46, 46, 51, 215, + 192, 248, 237, 238, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 264, 244, 49, 27, 28, 29, + 49, 271, 257, 33, 34, 35, 1, 172, 271, 5, + 230, 41, 262, 224, -1, 45, -1, -1, 234, -1, + 15, 16, 17, 18, 19, 20, 21, 22, 23, -1, + -1, -1, -1, 28, 29, -1, -1, -1, 33, 34, + 35, -1, -1, -1, -1, -1, 41, -1, -1, -1, + 45, 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, -1, -1, + -1, 33, -1, -1, -1, -1, -1, 39, 40, 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, -1, -1, -1, 33, + 34, 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, -1, -1, + -1, 33, 34, 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, + -1, -1, -1, 33, 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, -1, -1, -1, 33, 3, 4, 5, 6, 7, @@ -1023,22 +1030,12 @@ static const yytype_int16 yycheck[] = 27, 28, 29, -1, -1, -1, 33, 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, -1, -1, -1, 33, 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, -1, -1, -1, 33, 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, -1, -1, -1, 33, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - -1, -1, -1, -1, 28, 29, -1, -1, -1, 33, - 34, -1, -1, -1, -1, -1, -1, 41, 15, 16, + 26, 27, 28, 29, -1, -1, -1, 33, 15, 16, 17, 18, 19, 20, 21, 22, 23, -1, -1, -1, -1, 28, 29, -1, -1, -1, 33, 34, -1, -1, - -1, -1, -1, 1, 41, 3, 4, 5, 6, 7, - 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, - 22, 23, -1, -1, -1, -1, 24, 29, -1, -1, - -1, 33, 34 + -1, -1, -1, -1, 41, 15, 16, 17, 18, 19, + 20, 21, 22, 23, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of @@ -1046,33 +1043,33 @@ static const yytype_int16 yycheck[] = static const yytype_int8 yystos[] = { 0, 54, 60, 0, 35, 37, 56, 57, 58, 59, - 1, 30, 36, 116, 117, 1, 38, 117, 1, 3, + 1, 30, 36, 115, 116, 1, 38, 116, 1, 3, 4, 5, 6, 7, 8, 9, 10, 24, 61, 62, - 65, 66, 67, 73, 74, 75, 77, 78, 79, 80, - 92, 93, 94, 101, 102, 103, 119, 57, 36, 116, - 36, 49, 38, 38, 43, 33, 34, 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, 33, 39, 121, 33, 121, 33, - 121, 33, 121, 50, 50, 33, 120, 121, 58, 43, - 55, 12, 47, 69, 83, 43, 55, 76, 43, 55, - 82, 83, 43, 55, 83, 97, 43, 55, 43, 43, - 55, 43, 116, 63, 64, 31, 33, 34, 112, 115, - 58, 58, 104, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 29, 112, 113, 114, 68, 112, 44, 81, - 112, 23, 29, 96, 112, 95, 44, 44, 46, 114, - 114, 44, 52, 52, 120, 44, 1, 58, 84, 44, - 49, 44, 60, 60, 51, 49, 58, 105, 106, 48, - 84, 43, 28, 41, 70, 71, 72, 85, 114, 45, - 84, 112, 1, 58, 98, 45, 45, 120, 58, 33, - 107, 121, 45, 49, 25, 26, 30, 31, 32, 112, - 118, 45, 84, 46, 115, 70, 114, 48, 43, 33, - 121, 45, 43, 27, 87, 88, 89, 45, 114, 48, - 58, 46, 118, 84, 98, 14, 71, 86, 114, 1, - 11, 57, 72, 108, 109, 110, 114, 43, 51, 115, - 107, 114, 39, 40, 46, 108, 108, 46, 49, 121, - 98, 120, 91, 90, 108, 13, 111, 111, 99, 100, - 112, 121, 49, 100 + 65, 66, 67, 73, 74, 76, 77, 78, 79, 91, + 92, 93, 100, 101, 102, 118, 57, 36, 115, 36, + 49, 38, 38, 43, 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, 33, 34, 119, 121, 33, 39, 40, 120, 121, + 33, 121, 33, 121, 119, 50, 50, 119, 58, 43, + 55, 12, 47, 69, 82, 43, 55, 43, 55, 81, + 82, 43, 55, 82, 96, 43, 55, 43, 43, 55, + 43, 115, 64, 63, 31, 33, 34, 111, 114, 75, + 58, 58, 103, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 29, 111, 112, 113, 68, 111, 80, 111, + 23, 29, 95, 111, 94, 44, 44, 46, 44, 113, + 113, 44, 52, 52, 119, 44, 44, 49, 44, 60, + 60, 1, 58, 83, 51, 49, 58, 104, 105, 48, + 83, 83, 111, 1, 58, 97, 45, 45, 43, 28, + 41, 70, 71, 72, 84, 113, 45, 119, 58, 33, + 106, 121, 45, 49, 25, 26, 30, 31, 32, 111, + 117, 45, 45, 43, 27, 86, 87, 88, 45, 83, + 46, 114, 70, 113, 48, 43, 33, 121, 113, 48, + 58, 97, 14, 71, 85, 113, 1, 11, 57, 72, + 107, 108, 109, 113, 43, 46, 117, 83, 51, 114, + 106, 113, 120, 46, 107, 107, 46, 49, 121, 97, + 119, 90, 89, 107, 13, 110, 110, 98, 99, 111, + 121, 49, 99 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ @@ -1083,20 +1080,20 @@ static const yytype_int8 yyr1[] = 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 63, 62, 64, 62, 65, 65, 66, 68, 67, 69, 69, 70, 71, 71, 71, 72, 72, 73, - 73, 74, 76, 75, 77, 77, 78, 78, 79, 81, - 80, 82, 82, 83, 83, 84, 84, 84, 84, 85, - 85, 85, 85, 86, 86, 86, 87, 87, 88, 88, - 90, 89, 91, 89, 92, 92, 93, 95, 94, 96, - 96, 96, 96, 97, 97, 98, 98, 98, 98, 99, - 99, 100, 100, 101, 102, 104, 103, 105, 105, 105, - 106, 106, 107, 107, 107, 108, 108, 108, 108, 108, - 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 113, 114, 114, - 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, - 118, 118, 118, 118, 119, 120, 120, 120, 121, 121, + 75, 74, 76, 76, 77, 77, 78, 80, 79, 81, + 81, 82, 82, 83, 83, 83, 83, 84, 84, 84, + 84, 85, 85, 85, 86, 86, 87, 89, 88, 90, + 88, 91, 91, 92, 94, 93, 95, 95, 95, 95, + 96, 96, 97, 97, 97, 97, 98, 98, 99, 99, + 100, 101, 103, 102, 104, 104, 104, 105, 105, 106, + 106, 106, 107, 107, 107, 107, 107, 108, 108, 109, + 109, 110, 110, 111, 111, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 113, 113, 113, 113, 114, + 114, 115, 115, 116, 116, 117, 117, 117, 117, 117, + 117, 118, 119, 119, 119, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121 + 121, 121, 121, 121 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ @@ -1107,20 +1104,20 @@ static const yytype_int8 yyr2[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 6, 0, 6, 2, 2, 1, 0, 6, 2, 0, 2, 3, 2, 1, 2, 1, 2, - 2, 1, 0, 5, 2, 2, 4, 1, 1, 0, - 6, 2, 0, 1, 1, 4, 3, 2, 0, 1, - 3, 2, 1, 2, 1, 1, 1, 0, 3, 3, - 0, 5, 0, 5, 2, 2, 1, 0, 6, 3, - 1, 1, 1, 2, 0, 4, 3, 2, 0, 3, - 1, 1, 1, 6, 9, 0, 6, 1, 2, 0, - 4, 2, 1, 3, 1, 1, 2, 1, 2, 2, - 1, 0, 1, 3, 2, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, - 1, 2, 1, 1, 2, 1, 3, 1, 1, 1, - 1, 1, 1, 1, 6, 1, 1, 0, 1, 1, + 0, 6, 2, 2, 4, 1, 1, 0, 6, 2, + 0, 1, 1, 4, 3, 2, 0, 1, 3, 2, + 1, 2, 1, 1, 1, 0, 3, 0, 5, 0, + 5, 2, 2, 1, 0, 6, 3, 1, 1, 1, + 2, 0, 4, 3, 2, 0, 3, 1, 1, 1, + 6, 9, 0, 6, 1, 2, 0, 4, 2, 1, + 3, 1, 1, 2, 1, 2, 2, 1, 0, 1, + 3, 2, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, + 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 6, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 + 1, 1, 1, 1 }; @@ -1930,21 +1927,21 @@ YYLTYPE yylloc = yyloc_default; #line 203 "src/Slice/Grammar.y" { } -#line 1934 "src/Slice/Grammar.cpp" +#line 1931 "src/Slice/Grammar.cpp" break; case 3: /* opt_semicolon: ';' */ #line 211 "src/Slice/Grammar.y" { } -#line 1941 "src/Slice/Grammar.cpp" +#line 1938 "src/Slice/Grammar.cpp" break; case 4: /* opt_semicolon: %empty */ #line 214 "src/Slice/Grammar.y" { } -#line 1948 "src/Slice/Grammar.cpp" +#line 1945 "src/Slice/Grammar.cpp" break; case 5: /* file_metadata: "[[" metadata_list "]]" */ @@ -1952,7 +1949,7 @@ YYLTYPE yylloc = yyloc_default; { yyval = yyvsp[-1]; } -#line 1956 "src/Slice/Grammar.cpp" +#line 1953 "src/Slice/Grammar.cpp" break; case 6: /* file_metadata: "[[" error "]]" */ @@ -1960,7 +1957,7 @@ YYLTYPE yylloc = yyloc_default; { yyval = make_shared(); } -#line 1964 "src/Slice/Grammar.cpp" +#line 1961 "src/Slice/Grammar.cpp" break; case 7: /* file_metadata: "[[" "]]" */ @@ -1969,7 +1966,7 @@ YYLTYPE yylloc = yyloc_default; currentUnit->warning(WarningCategory::All, "No directives were provided in metadata list"); yyval = make_shared(); } -#line 1973 "src/Slice/Grammar.cpp" +#line 1970 "src/Slice/Grammar.cpp" break; case 8: /* local_metadata: "[" metadata_list "]" */ @@ -1977,7 +1974,7 @@ YYLTYPE yylloc = yyloc_default; { yyval = yyvsp[-1]; } -#line 1981 "src/Slice/Grammar.cpp" +#line 1978 "src/Slice/Grammar.cpp" break; case 9: /* local_metadata: "[" error "]" */ @@ -1985,7 +1982,7 @@ YYLTYPE yylloc = yyloc_default; { yyval = make_shared(); } -#line 1989 "src/Slice/Grammar.cpp" +#line 1986 "src/Slice/Grammar.cpp" break; case 10: /* local_metadata: "[" "]" */ @@ -1994,14 +1991,14 @@ YYLTYPE yylloc = yyloc_default; currentUnit->warning(WarningCategory::All, "No directives were provided in metadata list"); yyval = make_shared(); } -#line 1998 "src/Slice/Grammar.cpp" +#line 1995 "src/Slice/Grammar.cpp" break; case 11: /* metadata: metadata_directives */ #line 258 "src/Slice/Grammar.y" { } -#line 2005 "src/Slice/Grammar.cpp" +#line 2002 "src/Slice/Grammar.cpp" break; case 12: /* metadata: %empty */ @@ -2009,7 +2006,7 @@ YYLTYPE yylloc = yyloc_default; { yyval = make_shared(); } -#line 2013 "src/Slice/Grammar.cpp" +#line 2010 "src/Slice/Grammar.cpp" break; case 13: /* metadata_directives: local_metadata */ @@ -2017,7 +2014,7 @@ YYLTYPE yylloc = yyloc_default; { yyval = yyvsp[0]; } -#line 2021 "src/Slice/Grammar.cpp" +#line 2018 "src/Slice/Grammar.cpp" break; case 14: /* metadata_directives: metadata_directives local_metadata */ @@ -2028,7 +2025,7 @@ YYLTYPE yylloc = yyloc_default; metadata1->v.splice(metadata1->v.end(), std::move(metadata2->v)); yyval = metadata1; } -#line 2032 "src/Slice/Grammar.cpp" +#line 2029 "src/Slice/Grammar.cpp" break; case 15: /* definitions: definitions file_metadata */ @@ -2040,7 +2037,7 @@ YYLTYPE yylloc = yyloc_default; currentUnit->addFileMetadata(std::move(metadata->v)); } } -#line 2044 "src/Slice/Grammar.cpp" +#line 2041 "src/Slice/Grammar.cpp" break; case 16: /* definitions: definitions metadata definition */ @@ -2053,22 +2050,22 @@ YYLTYPE yylloc = yyloc_default; contained->appendMetadata(std::move(metadata->v)); } } -#line 2057 "src/Slice/Grammar.cpp" +#line 2054 "src/Slice/Grammar.cpp" break; case 17: /* definitions: %empty */ #line 303 "src/Slice/Grammar.y" { } -#line 2064 "src/Slice/Grammar.cpp" +#line 2061 "src/Slice/Grammar.cpp" break; case 18: /* definition: module_def opt_semicolon */ #line 311 "src/Slice/Grammar.y" { - assert(yyvsp[-1] == nullptr || dynamic_pointer_cast(yyvsp[-1])); + assert(dynamic_pointer_cast(yyvsp[-1])); } -#line 2072 "src/Slice/Grammar.cpp" +#line 2069 "src/Slice/Grammar.cpp" break; case 19: /* definition: class_decl ';' */ @@ -2076,7 +2073,7 @@ YYLTYPE yylloc = yyloc_default; { assert(yyvsp[-1] == nullptr || dynamic_pointer_cast(yyvsp[-1])); } -#line 2080 "src/Slice/Grammar.cpp" +#line 2077 "src/Slice/Grammar.cpp" break; case 20: /* definition: class_def opt_semicolon */ @@ -2084,7 +2081,7 @@ YYLTYPE yylloc = yyloc_default; { assert(yyvsp[-1] == nullptr || dynamic_pointer_cast(yyvsp[-1])); } -#line 2088 "src/Slice/Grammar.cpp" +#line 2085 "src/Slice/Grammar.cpp" break; case 21: /* definition: interface_decl ';' */ @@ -2092,7 +2089,7 @@ YYLTYPE yylloc = yyloc_default; { assert(yyvsp[-1] == nullptr || dynamic_pointer_cast(yyvsp[-1])); } -#line 2096 "src/Slice/Grammar.cpp" +#line 2093 "src/Slice/Grammar.cpp" break; case 22: /* definition: interface_def opt_semicolon */ @@ -2100,7 +2097,7 @@ YYLTYPE yylloc = yyloc_default; { assert(yyvsp[-1] == nullptr || dynamic_pointer_cast(yyvsp[-1])); } -#line 2104 "src/Slice/Grammar.cpp" +#line 2101 "src/Slice/Grammar.cpp" break; case 23: /* definition: exception_decl ';' */ @@ -2108,7 +2105,7 @@ YYLTYPE yylloc = yyloc_default; { assert(yyvsp[-1] == nullptr); } -#line 2112 "src/Slice/Grammar.cpp" +#line 2109 "src/Slice/Grammar.cpp" break; case 24: /* definition: exception_def opt_semicolon */ @@ -2116,7 +2113,7 @@ YYLTYPE yylloc = yyloc_default; { assert(yyvsp[-1] == nullptr || dynamic_pointer_cast(yyvsp[-1])); } -#line 2120 "src/Slice/Grammar.cpp" +#line 2117 "src/Slice/Grammar.cpp" break; case 25: /* definition: struct_decl ';' */ @@ -2124,15 +2121,15 @@ YYLTYPE yylloc = yyloc_default; { assert(yyvsp[-1] == nullptr); } -#line 2128 "src/Slice/Grammar.cpp" +#line 2125 "src/Slice/Grammar.cpp" break; case 26: /* definition: struct_def opt_semicolon */ #line 343 "src/Slice/Grammar.y" { - assert(yyvsp[-1] == nullptr || dynamic_pointer_cast(yyvsp[-1])); + assert(dynamic_pointer_cast(yyvsp[-1])); } -#line 2136 "src/Slice/Grammar.cpp" +#line 2133 "src/Slice/Grammar.cpp" break; case 27: /* definition: sequence_def ';' */ @@ -2140,7 +2137,7 @@ YYLTYPE yylloc = yyloc_default; { assert(dynamic_pointer_cast(yyvsp[-1])); } -#line 2144 "src/Slice/Grammar.cpp" +#line 2141 "src/Slice/Grammar.cpp" break; case 28: /* definition: dictionary_def ';' */ @@ -2148,7 +2145,7 @@ YYLTYPE yylloc = yyloc_default; { assert(dynamic_pointer_cast(yyvsp[-1])); } -#line 2152 "src/Slice/Grammar.cpp" +#line 2149 "src/Slice/Grammar.cpp" break; case 29: /* definition: enum_def opt_semicolon */ @@ -2156,7 +2153,7 @@ YYLTYPE yylloc = yyloc_default; { assert(dynamic_pointer_cast(yyvsp[-1])); } -#line 2160 "src/Slice/Grammar.cpp" +#line 2157 "src/Slice/Grammar.cpp" break; case 30: /* definition: const_def ';' */ @@ -2164,7 +2161,7 @@ YYLTYPE yylloc = yyloc_default; { assert(dynamic_pointer_cast(yyvsp[-1])); } -#line 2168 "src/Slice/Grammar.cpp" +#line 2165 "src/Slice/Grammar.cpp" break; case 31: /* definition: error ';' */ @@ -2172,7 +2169,7 @@ YYLTYPE yylloc = yyloc_default; { yyerrok; } -#line 2176 "src/Slice/Grammar.cpp" +#line 2173 "src/Slice/Grammar.cpp" break; case 32: /* @1: %empty */ @@ -2183,44 +2180,31 @@ YYLTYPE yylloc = yyloc_default; auto ident = dynamic_pointer_cast(yyvsp[0]); ContainerPtr cont = currentUnit->currentContainer(); ModulePtr module = cont->createModule(ident->v, false); - if (module) - { - cont->checkHasChangedMeaning(ident->v, module); - currentUnit->pushContainer(module); - yyval = module; - } - else - { - yyval = nullptr; - } + + cont->checkHasChangedMeaning(ident->v, module); + currentUnit->pushContainer(module); + yyval = module; } -#line 2198 "src/Slice/Grammar.cpp" +#line 2189 "src/Slice/Grammar.cpp" break; - case 33: /* module_def: "module keyword" "identifier" @1 '{' definitions '}' */ -#line 390 "src/Slice/Grammar.y" + case 33: /* module_def: "module keyword" definition_name @1 '{' definitions '}' */ +#line 384 "src/Slice/Grammar.y" { - if (yyvsp[-3]) - { - currentUnit->popContainer(); - yyval = yyvsp[-3]; - } - else - { - yyval = nullptr; - } + currentUnit->popContainer(); + yyval = yyvsp[-3]; } -#line 2214 "src/Slice/Grammar.cpp" +#line 2198 "src/Slice/Grammar.cpp" break; case 34: /* @2: %empty */ -#line 402 "src/Slice/Grammar.y" +#line 389 "src/Slice/Grammar.y" { currentUnit->setSeenDefinition(); auto ident = dynamic_pointer_cast(yyvsp[0]); - // Reject scoped identifiers starting with "::". This is generally indicates global scope, but is invalid here. + // Reject scoped identifiers starting with "::". This generally indicates global scope, but is invalid here. size_t startPos = 0; if (ident->v.find("::") == 0) { @@ -2244,91 +2228,72 @@ YYLTYPE yylloc = yyloc_default; { const auto currentModuleName = modules[i]; ModulePtr module = cont->createModule(currentModuleName, true); - if (module) - { - cont->checkHasChangedMeaning(currentModuleName, module); - currentUnit->pushContainer(module); - yyval = cont = module; - } - else - { - // If an error occurs while creating one of the modules, we have to stop. But, to eagerly report as many - // errors as possible, we still 'create' any remaining modules, which will run _some_ validation on them. - for (size_t j = (i + 1); j < modules.size(); j++) - { - cont->createModule(modules[j], true); // Dummy - } - // Then we roll back the chain, i.e. pop the successfully-created-modules off the container stack. - for (; i > 0; i--) - { - currentUnit->popContainer(); - } - yyval = nullptr; - break; - } + cont->checkHasChangedMeaning(currentModuleName, module); + currentUnit->pushContainer(module); + yyval = cont = module; } } -#line 2273 "src/Slice/Grammar.cpp" +#line 2238 "src/Slice/Grammar.cpp" break; case 35: /* module_def: "module keyword" "scoped identifier" @2 '{' definitions '}' */ -#line 457 "src/Slice/Grammar.y" +#line 425 "src/Slice/Grammar.y" { - if (yyvsp[-3]) - { - // We need to pop '(N+1)' modules off the container stack, to navigate out of the nested module. - // Where `N` is the number of scope separators ("::"). - size_t startPos = 0; - auto ident = dynamic_pointer_cast(yyvsp[-4]); - while ((startPos = ident->v.find("::", startPos)) != string::npos) - { - currentUnit->popContainer(); - startPos += 2; // Skip the "::" separator. - } + // We need to pop '(N+1)' modules off the container stack, to navigate out of the nested module. + // Where `N` is the number of scope separators ("::"). + size_t startPos = 0; + auto ident = dynamic_pointer_cast(yyvsp[-4]); - // Set the 'return value' to the outer-most module, before we pop it off the stack. - // Whichever module we return, is the one that metadata will be applied to. - yyval = currentUnit->currentContainer(); - currentUnit->popContainer(); + // Skip over any leading "::". This is invalid syntax of course, but the parser still needs to properly handle it. + if (ident->v.find("::") == 0) + { + startPos += 2; // Skip the leading "::". } - else + + while ((startPos = ident->v.find("::", startPos)) != string::npos) { - yyval = nullptr; + currentUnit->popContainer(); + startPos += 2; // Skip the "::" separator. } + + // Set the 'return value' to the outer-most module, before we pop it off the stack. + // Whichever module we return, is the one that metadata will be applied to. + yyval = currentUnit->currentContainer(); + currentUnit->popContainer(); } -#line 2301 "src/Slice/Grammar.cpp" +#line 2266 "src/Slice/Grammar.cpp" break; case 36: /* exception_id: "exception keyword" "identifier" */ -#line 486 "src/Slice/Grammar.y" +#line 454 "src/Slice/Grammar.y" { yyval = yyvsp[0]; } -#line 2309 "src/Slice/Grammar.cpp" +#line 2274 "src/Slice/Grammar.cpp" break; case 37: /* exception_id: "exception keyword" keyword */ -#line 490 "src/Slice/Grammar.y" +#line 458 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); currentUnit->error("keyword '" + ident->v + "' cannot be used as exception name"); yyval = yyvsp[0]; // Dummy } -#line 2319 "src/Slice/Grammar.cpp" +#line 2284 "src/Slice/Grammar.cpp" break; case 38: /* exception_decl: exception_id */ -#line 501 "src/Slice/Grammar.y" +#line 469 "src/Slice/Grammar.y" { currentUnit->error("exceptions cannot be forward declared"); yyval = nullptr; } -#line 2328 "src/Slice/Grammar.cpp" +#line 2293 "src/Slice/Grammar.cpp" break; case 39: /* @3: %empty */ -#line 511 "src/Slice/Grammar.y" +#line 479 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[-1]); auto base = dynamic_pointer_cast(yyvsp[0]); @@ -2341,11 +2306,11 @@ YYLTYPE yylloc = yyloc_default; } yyval = ex; } -#line 2345 "src/Slice/Grammar.cpp" +#line 2310 "src/Slice/Grammar.cpp" break; case 40: /* exception_def: exception_id exception_extends @3 '{' data_members '}' */ -#line 524 "src/Slice/Grammar.y" +#line 492 "src/Slice/Grammar.y" { if (yyvsp[-3]) { @@ -2353,11 +2318,11 @@ YYLTYPE yylloc = yyloc_default; } yyval = yyvsp[-3]; } -#line 2357 "src/Slice/Grammar.cpp" +#line 2322 "src/Slice/Grammar.cpp" break; case 41: /* exception_extends: extends scoped_name */ -#line 537 "src/Slice/Grammar.y" +#line 505 "src/Slice/Grammar.y" { auto scoped = dynamic_pointer_cast(yyvsp[0]); ContainerPtr cont = currentUnit->currentContainer(); @@ -2365,29 +2330,29 @@ YYLTYPE yylloc = yyloc_default; cont->checkHasChangedMeaning(scoped->v); yyval = contained; } -#line 2369 "src/Slice/Grammar.cpp" +#line 2334 "src/Slice/Grammar.cpp" break; case 42: /* exception_extends: %empty */ -#line 545 "src/Slice/Grammar.y" +#line 513 "src/Slice/Grammar.y" { yyval = nullptr; } -#line 2377 "src/Slice/Grammar.cpp" +#line 2342 "src/Slice/Grammar.cpp" break; case 43: /* type_id: type "identifier" */ -#line 554 "src/Slice/Grammar.y" +#line 522 "src/Slice/Grammar.y" { auto type = dynamic_pointer_cast(yyvsp[-1]); auto ident = dynamic_pointer_cast(yyvsp[0]); yyval = make_shared(type, ident->v); } -#line 2387 "src/Slice/Grammar.cpp" +#line 2352 "src/Slice/Grammar.cpp" break; case 44: /* optional: "optional(" integer_constant ')' */ -#line 565 "src/Slice/Grammar.y" +#line 533 "src/Slice/Grammar.y" { auto integer = dynamic_pointer_cast(yyvsp[-1]); int32_t tag = -1; @@ -2400,31 +2365,31 @@ YYLTYPE yylloc = yyloc_default; auto m = make_shared(tag); yyval = m; } -#line 2404 "src/Slice/Grammar.cpp" +#line 2369 "src/Slice/Grammar.cpp" break; case 45: /* optional: "optional(" ')' */ -#line 578 "src/Slice/Grammar.y" +#line 546 "src/Slice/Grammar.y" { currentUnit->error("missing tag"); auto m = make_shared(-1); // Dummy yyval = m; } -#line 2414 "src/Slice/Grammar.cpp" +#line 2379 "src/Slice/Grammar.cpp" break; case 46: /* optional: "optional keyword" */ -#line 584 "src/Slice/Grammar.y" +#line 552 "src/Slice/Grammar.y" { currentUnit->error("missing tag"); auto m = make_shared(-1); // Dummy yyval = m; } -#line 2424 "src/Slice/Grammar.cpp" +#line 2389 "src/Slice/Grammar.cpp" break; case 47: /* optional_type_id: optional type_id */ -#line 595 "src/Slice/Grammar.y" +#line 563 "src/Slice/Grammar.y" { auto m = dynamic_pointer_cast(yyvsp[-1]); auto ts = dynamic_pointer_cast(yyvsp[0]); @@ -2441,11 +2406,11 @@ YYLTYPE yylloc = yyloc_default; yyval = m; } -#line 2445 "src/Slice/Grammar.cpp" +#line 2410 "src/Slice/Grammar.cpp" break; case 48: /* optional_type_id: type_id */ -#line 612 "src/Slice/Grammar.y" +#line 580 "src/Slice/Grammar.y" { auto ts = dynamic_pointer_cast(yyvsp[0]); auto m = make_shared(-1); @@ -2453,98 +2418,68 @@ YYLTYPE yylloc = yyloc_default; m->name = ts->name; yyval = m; } -#line 2457 "src/Slice/Grammar.cpp" - break; - - case 49: /* struct_id: "struct keyword" "identifier" */ -#line 625 "src/Slice/Grammar.y" -{ - yyval = yyvsp[0]; -} -#line 2465 "src/Slice/Grammar.cpp" - break; - - case 50: /* struct_id: "struct keyword" keyword */ -#line 629 "src/Slice/Grammar.y" -{ - auto ident = dynamic_pointer_cast(yyvsp[0]); - currentUnit->error("keyword '" + ident->v + "' cannot be used as struct name"); - yyval = yyvsp[0]; // Dummy -} -#line 2475 "src/Slice/Grammar.cpp" +#line 2422 "src/Slice/Grammar.cpp" break; - case 51: /* struct_decl: struct_id */ -#line 640 "src/Slice/Grammar.y" + case 49: /* struct_decl: "struct keyword" definition_name */ +#line 593 "src/Slice/Grammar.y" { currentUnit->error("structs cannot be forward declared"); yyval = nullptr; // Dummy } -#line 2484 "src/Slice/Grammar.cpp" +#line 2431 "src/Slice/Grammar.cpp" break; - case 52: /* @4: %empty */ -#line 650 "src/Slice/Grammar.y" + case 50: /* @4: %empty */ +#line 603 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); ContainerPtr cont = currentUnit->currentContainer(); StructPtr st = cont->createStruct(ident->v); - if (st) - { - cont->checkHasChangedMeaning(ident->v, st); - currentUnit->pushContainer(st); - } - else - { - st = cont->createStruct(Ice::generateUUID()); // Dummy - assert(st); - currentUnit->pushContainer(st); - } + + cont->checkHasChangedMeaning(ident->v, st); + currentUnit->pushContainer(st); yyval = st; } -#line 2506 "src/Slice/Grammar.cpp" +#line 2445 "src/Slice/Grammar.cpp" break; - case 53: /* struct_def: struct_id @4 '{' data_members '}' */ -#line 668 "src/Slice/Grammar.y" + case 51: /* struct_def: "struct keyword" definition_name @4 '{' data_members '}' */ +#line 613 "src/Slice/Grammar.y" { - if (yyvsp[-3]) - { - currentUnit->popContainer(); - } - yyval = yyvsp[-3]; + currentUnit->popContainer(); // Empty structures are not allowed - auto st = dynamic_pointer_cast(yyval); - assert(st); + auto st = dynamic_pointer_cast(yyvsp[-3]); if (st->dataMembers().empty()) { - currentUnit->error("struct '" + st->name() + "' must have at least one member"); // $$ is a dummy + currentUnit->error("struct '" + st->name() + "' must have at least one member"); } + yyval = st; } -#line 2526 "src/Slice/Grammar.cpp" +#line 2461 "src/Slice/Grammar.cpp" break; - case 54: /* class_name: "class keyword" "identifier" */ -#line 689 "src/Slice/Grammar.y" + case 52: /* class_name: "class keyword" "identifier" */ +#line 630 "src/Slice/Grammar.y" { yyval = yyvsp[0]; } -#line 2534 "src/Slice/Grammar.cpp" +#line 2469 "src/Slice/Grammar.cpp" break; - case 55: /* class_name: "class keyword" keyword */ -#line 693 "src/Slice/Grammar.y" + case 53: /* class_name: "class keyword" keyword */ +#line 634 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); currentUnit->error("keyword '" + ident->v + "' cannot be used as class name"); yyval = yyvsp[0]; // Dummy } -#line 2544 "src/Slice/Grammar.cpp" +#line 2479 "src/Slice/Grammar.cpp" break; - case 56: /* class_id: "class keyword" "identifier(" integer_constant ')' */ -#line 704 "src/Slice/Grammar.y" + case 54: /* class_id: "class keyword" definition_name_open integer_constant ')' */ +#line 645 "src/Slice/Grammar.y" { auto integer = dynamic_pointer_cast(yyvsp[-1]); int32_t id = -1; @@ -2564,33 +2499,33 @@ YYLTYPE yylloc = yyloc_default; classId->t = id; yyval = classId; } -#line 2568 "src/Slice/Grammar.cpp" +#line 2503 "src/Slice/Grammar.cpp" break; - case 57: /* class_id: class_name */ -#line 724 "src/Slice/Grammar.y" + case 55: /* class_id: class_name */ +#line 665 "src/Slice/Grammar.y" { auto classId = make_shared(); classId->v = dynamic_pointer_cast(yyvsp[0])->v; classId->t = -1; yyval = classId; } -#line 2579 "src/Slice/Grammar.cpp" +#line 2514 "src/Slice/Grammar.cpp" break; - case 58: /* class_decl: class_name */ -#line 736 "src/Slice/Grammar.y" + case 56: /* class_decl: class_name */ +#line 677 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); ContainerPtr cont = currentUnit->currentContainer(); ClassDeclPtr cl = cont->createClassDecl(ident->v); yyval = cl; } -#line 2590 "src/Slice/Grammar.cpp" +#line 2525 "src/Slice/Grammar.cpp" break; - case 59: /* @5: %empty */ -#line 748 "src/Slice/Grammar.y" + case 57: /* @5: %empty */ +#line 689 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[-1]); ContainerPtr cont = currentUnit->currentContainer(); @@ -2607,11 +2542,11 @@ YYLTYPE yylloc = yyloc_default; yyval = nullptr; } } -#line 2611 "src/Slice/Grammar.cpp" +#line 2546 "src/Slice/Grammar.cpp" break; - case 60: /* class_def: class_id class_extends @5 '{' data_members '}' */ -#line 765 "src/Slice/Grammar.y" + case 58: /* class_def: class_id class_extends @5 '{' data_members '}' */ +#line 706 "src/Slice/Grammar.y" { if (yyvsp[-3]) { @@ -2623,11 +2558,11 @@ YYLTYPE yylloc = yyloc_default; yyval = nullptr; } } -#line 2627 "src/Slice/Grammar.cpp" +#line 2562 "src/Slice/Grammar.cpp" break; - case 61: /* class_extends: extends scoped_name */ -#line 782 "src/Slice/Grammar.y" + case 59: /* class_extends: extends scoped_name */ +#line 723 "src/Slice/Grammar.y" { auto scoped = dynamic_pointer_cast(yyvsp[0]); ContainerPtr cont = currentUnit->currentContainer(); @@ -2655,33 +2590,33 @@ YYLTYPE yylloc = yyloc_default; } } } -#line 2659 "src/Slice/Grammar.cpp" +#line 2594 "src/Slice/Grammar.cpp" break; - case 62: /* class_extends: %empty */ -#line 810 "src/Slice/Grammar.y" + case 60: /* class_extends: %empty */ +#line 751 "src/Slice/Grammar.y" { yyval = nullptr; } -#line 2667 "src/Slice/Grammar.cpp" +#line 2602 "src/Slice/Grammar.cpp" break; - case 63: /* extends: "extends keyword" */ -#line 819 "src/Slice/Grammar.y" + case 61: /* extends: "extends keyword" */ +#line 760 "src/Slice/Grammar.y" { } -#line 2674 "src/Slice/Grammar.cpp" +#line 2609 "src/Slice/Grammar.cpp" break; - case 64: /* extends: ':' */ -#line 822 "src/Slice/Grammar.y" + case 62: /* extends: ':' */ +#line 763 "src/Slice/Grammar.y" { } -#line 2681 "src/Slice/Grammar.cpp" +#line 2616 "src/Slice/Grammar.cpp" break; - case 65: /* data_members: metadata data_member ';' data_members */ -#line 830 "src/Slice/Grammar.y" + case 63: /* data_members: metadata data_member ';' data_members */ +#line 771 "src/Slice/Grammar.y" { auto metadata = dynamic_pointer_cast(yyvsp[-3]); auto contained = dynamic_pointer_cast(yyvsp[-2]); @@ -2690,33 +2625,33 @@ YYLTYPE yylloc = yyloc_default; contained->appendMetadata(std::move(metadata->v)); } } -#line 2694 "src/Slice/Grammar.cpp" +#line 2629 "src/Slice/Grammar.cpp" break; - case 66: /* data_members: error ';' data_members */ -#line 839 "src/Slice/Grammar.y" + case 64: /* data_members: error ';' data_members */ +#line 780 "src/Slice/Grammar.y" { } -#line 2701 "src/Slice/Grammar.cpp" +#line 2636 "src/Slice/Grammar.cpp" break; - case 67: /* data_members: metadata data_member */ -#line 842 "src/Slice/Grammar.y" + case 65: /* data_members: metadata data_member */ +#line 783 "src/Slice/Grammar.y" { currentUnit->error("';' missing after definition"); } -#line 2709 "src/Slice/Grammar.cpp" +#line 2644 "src/Slice/Grammar.cpp" break; - case 68: /* data_members: %empty */ -#line 846 "src/Slice/Grammar.y" + case 66: /* data_members: %empty */ +#line 787 "src/Slice/Grammar.y" { } -#line 2716 "src/Slice/Grammar.cpp" +#line 2651 "src/Slice/Grammar.cpp" break; - case 69: /* data_member: optional_type_id */ -#line 854 "src/Slice/Grammar.y" + case 67: /* data_member: optional_type_id */ +#line 795 "src/Slice/Grammar.y" { auto def = dynamic_pointer_cast(yyvsp[0]); auto cl = dynamic_pointer_cast(currentUnit->currentContainer()); @@ -2746,11 +2681,11 @@ YYLTYPE yylloc = yyloc_default; currentUnit->currentContainer()->checkHasChangedMeaning(def->name, dm); yyval = dm; } -#line 2750 "src/Slice/Grammar.cpp" +#line 2685 "src/Slice/Grammar.cpp" break; - case 70: /* data_member: optional_type_id '=' const_initializer */ -#line 884 "src/Slice/Grammar.y" + case 68: /* data_member: optional_type_id '=' const_initializer */ +#line 825 "src/Slice/Grammar.y" { auto def = dynamic_pointer_cast(yyvsp[-2]); auto value = dynamic_pointer_cast(yyvsp[0]); @@ -2781,11 +2716,11 @@ YYLTYPE yylloc = yyloc_default; currentUnit->currentContainer()->checkHasChangedMeaning(def->name, dm); yyval = dm; } -#line 2785 "src/Slice/Grammar.cpp" +#line 2720 "src/Slice/Grammar.cpp" break; - case 71: /* data_member: type keyword */ -#line 915 "src/Slice/Grammar.y" + case 69: /* data_member: type keyword */ +#line 856 "src/Slice/Grammar.y" { auto type = dynamic_pointer_cast(yyvsp[-1]); string name = dynamic_pointer_cast(yyvsp[0])->v; @@ -2807,11 +2742,11 @@ YYLTYPE yylloc = yyloc_default; assert(yyval); currentUnit->error("keyword '" + name + "' cannot be used as data member name"); } -#line 2811 "src/Slice/Grammar.cpp" +#line 2746 "src/Slice/Grammar.cpp" break; - case 72: /* data_member: type */ -#line 937 "src/Slice/Grammar.y" + case 70: /* data_member: type */ +#line 878 "src/Slice/Grammar.y" { auto type = dynamic_pointer_cast(yyvsp[0]); auto cl = dynamic_pointer_cast(currentUnit->currentContainer()); @@ -2832,11 +2767,11 @@ YYLTYPE yylloc = yyloc_default; assert(yyval); currentUnit->error("missing data member name"); } -#line 2836 "src/Slice/Grammar.cpp" +#line 2771 "src/Slice/Grammar.cpp" break; - case 73: /* return_type: optional type */ -#line 963 "src/Slice/Grammar.y" + case 71: /* return_type: optional type */ +#line 904 "src/Slice/Grammar.y" { auto m = dynamic_pointer_cast(yyvsp[-1]); m->type = dynamic_pointer_cast(yyvsp[0]); @@ -2851,46 +2786,46 @@ YYLTYPE yylloc = yyloc_default; yyval = m; } -#line 2855 "src/Slice/Grammar.cpp" +#line 2790 "src/Slice/Grammar.cpp" break; - case 74: /* return_type: type */ -#line 978 "src/Slice/Grammar.y" + case 72: /* return_type: type */ +#line 919 "src/Slice/Grammar.y" { auto m = make_shared(-1); m->type = dynamic_pointer_cast(yyvsp[0]); yyval = m; } -#line 2865 "src/Slice/Grammar.cpp" +#line 2800 "src/Slice/Grammar.cpp" break; - case 75: /* return_type: "void keyword" */ -#line 984 "src/Slice/Grammar.y" + case 73: /* return_type: "void keyword" */ +#line 925 "src/Slice/Grammar.y" { auto m = make_shared(-1); yyval = m; } -#line 2874 "src/Slice/Grammar.cpp" +#line 2809 "src/Slice/Grammar.cpp" break; - case 76: /* idempotent_modifier: "idempotent keyword" */ -#line 994 "src/Slice/Grammar.y" + case 74: /* idempotent_modifier: "idempotent keyword" */ +#line 935 "src/Slice/Grammar.y" { yyval = make_shared(true); } -#line 2882 "src/Slice/Grammar.cpp" +#line 2817 "src/Slice/Grammar.cpp" break; - case 77: /* idempotent_modifier: %empty */ -#line 998 "src/Slice/Grammar.y" + case 75: /* idempotent_modifier: %empty */ +#line 939 "src/Slice/Grammar.y" { yyval = make_shared(false); } -#line 2890 "src/Slice/Grammar.cpp" +#line 2825 "src/Slice/Grammar.cpp" break; - case 78: /* operation_preamble: idempotent_modifier return_type "identifier(" */ -#line 1007 "src/Slice/Grammar.y" + case 76: /* operation_preamble: idempotent_modifier return_type definition_name_open */ +#line 948 "src/Slice/Grammar.y" { bool isIdempotent = dynamic_pointer_cast(yyvsp[-2])->v; auto returnType = dynamic_pointer_cast(yyvsp[-1]); @@ -2905,11 +2840,8 @@ YYLTYPE yylloc = yyloc_default; returnType->tag, isIdempotent ? Operation::Idempotent : Operation::Normal); - if (op) - { - interface->checkHasChangedMeaning(name, op); - currentUnit->pushContainer(op); - } + interface->checkHasChangedMeaning(name, op); + currentUnit->pushContainer(op); yyval = op; } else @@ -2917,42 +2849,11 @@ YYLTYPE yylloc = yyloc_default; yyval = nullptr; } } -#line 2921 "src/Slice/Grammar.cpp" - break; - - case 79: /* operation_preamble: idempotent_modifier return_type "keyword(" */ -#line 1034 "src/Slice/Grammar.y" -{ - bool isIdempotent = dynamic_pointer_cast(yyvsp[-2])->v; - auto returnType = dynamic_pointer_cast(yyvsp[-1]); - string name = dynamic_pointer_cast(yyvsp[0])->v; - auto interface = dynamic_pointer_cast(currentUnit->currentContainer()); - if (interface) - { - OperationPtr op = interface->createOperation( - name, - returnType->type, - returnType->isOptional, - returnType->tag, - isIdempotent ? Operation::Idempotent : Operation::Normal); - - if (op) - { - currentUnit->pushContainer(op); - currentUnit->error("keyword '" + name + "' cannot be used as operation name"); - } - yyval = op; // Dummy - } - else - { - yyval = nullptr; - } -} -#line 2952 "src/Slice/Grammar.cpp" +#line 2853 "src/Slice/Grammar.cpp" break; - case 80: /* @6: %empty */ -#line 1066 "src/Slice/Grammar.y" + case 77: /* @6: %empty */ +#line 977 "src/Slice/Grammar.y" { if (yyvsp[-2]) { @@ -2973,11 +2874,11 @@ YYLTYPE yylloc = yyloc_default; } yyval = yyvsp[-2]; } -#line 2977 "src/Slice/Grammar.cpp" +#line 2878 "src/Slice/Grammar.cpp" break; - case 81: /* operation: operation_preamble parameters ')' @6 throws */ -#line 1087 "src/Slice/Grammar.y" + case 78: /* operation: operation_preamble parameters ')' @6 throws */ +#line 998 "src/Slice/Grammar.y" { auto op = dynamic_pointer_cast(yyvsp[-1]); auto el = dynamic_pointer_cast(yyvsp[0]); @@ -2987,11 +2888,11 @@ YYLTYPE yylloc = yyloc_default; op->setExceptionList(el->v); } } -#line 2991 "src/Slice/Grammar.cpp" +#line 2892 "src/Slice/Grammar.cpp" break; - case 82: /* @7: %empty */ -#line 1097 "src/Slice/Grammar.y" + case 79: /* @7: %empty */ +#line 1008 "src/Slice/Grammar.y" { if (yyvsp[-2]) { @@ -2999,11 +2900,11 @@ YYLTYPE yylloc = yyloc_default; } yyerrok; } -#line 3003 "src/Slice/Grammar.cpp" +#line 2904 "src/Slice/Grammar.cpp" break; - case 83: /* operation: operation_preamble error ')' @7 throws */ -#line 1105 "src/Slice/Grammar.y" + case 80: /* operation: operation_preamble error ')' @7 throws */ +#line 1016 "src/Slice/Grammar.y" { auto op = dynamic_pointer_cast(yyvsp[-1]); auto el = dynamic_pointer_cast(yyvsp[0]); @@ -3013,29 +2914,29 @@ YYLTYPE yylloc = yyloc_default; op->setExceptionList(el->v); // Dummy } } -#line 3017 "src/Slice/Grammar.cpp" +#line 2918 "src/Slice/Grammar.cpp" break; - case 84: /* interface_id: "interface keyword" "identifier" */ -#line 1120 "src/Slice/Grammar.y" + case 81: /* interface_id: "interface keyword" "identifier" */ +#line 1031 "src/Slice/Grammar.y" { yyval = yyvsp[0]; } -#line 3025 "src/Slice/Grammar.cpp" +#line 2926 "src/Slice/Grammar.cpp" break; - case 85: /* interface_id: "interface keyword" keyword */ -#line 1124 "src/Slice/Grammar.y" + case 82: /* interface_id: "interface keyword" keyword */ +#line 1035 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); currentUnit->error("keyword '" + ident->v + "' cannot be used as interface name"); yyval = yyvsp[0]; // Dummy } -#line 3035 "src/Slice/Grammar.cpp" +#line 2936 "src/Slice/Grammar.cpp" break; - case 86: /* interface_decl: interface_id */ -#line 1135 "src/Slice/Grammar.y" + case 83: /* interface_decl: interface_id */ +#line 1046 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); auto cont = currentUnit->currentContainer(); @@ -3043,11 +2944,11 @@ YYLTYPE yylloc = yyloc_default; cont->checkHasChangedMeaning(ident->v, cl); yyval = cl; } -#line 3047 "src/Slice/Grammar.cpp" +#line 2948 "src/Slice/Grammar.cpp" break; - case 87: /* @8: %empty */ -#line 1148 "src/Slice/Grammar.y" + case 84: /* @8: %empty */ +#line 1059 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[-1]); ContainerPtr cont = currentUnit->currentContainer(); @@ -3064,11 +2965,11 @@ YYLTYPE yylloc = yyloc_default; yyval = nullptr; } } -#line 3068 "src/Slice/Grammar.cpp" +#line 2969 "src/Slice/Grammar.cpp" break; - case 88: /* interface_def: interface_id interface_extends @8 '{' operations '}' */ -#line 1165 "src/Slice/Grammar.y" + case 85: /* interface_def: interface_id interface_extends @8 '{' operations '}' */ +#line 1076 "src/Slice/Grammar.y" { if (yyvsp[-3]) { @@ -3080,11 +2981,11 @@ YYLTYPE yylloc = yyloc_default; yyval = nullptr; } } -#line 3084 "src/Slice/Grammar.cpp" +#line 2985 "src/Slice/Grammar.cpp" break; - case 89: /* interface_list: interface_list ',' scoped_name */ -#line 1182 "src/Slice/Grammar.y" + case 86: /* interface_list: interface_list ',' scoped_name */ +#line 1093 "src/Slice/Grammar.y" { auto interfaces = dynamic_pointer_cast(yyvsp[-2]); auto scoped = dynamic_pointer_cast(yyvsp[0]); @@ -3094,11 +2995,11 @@ YYLTYPE yylloc = yyloc_default; } yyval = interfaces; } -#line 3098 "src/Slice/Grammar.cpp" +#line 2999 "src/Slice/Grammar.cpp" break; - case 90: /* interface_list: scoped_name */ -#line 1192 "src/Slice/Grammar.y" + case 87: /* interface_list: scoped_name */ +#line 1103 "src/Slice/Grammar.y" { auto interfaces = make_shared(); auto scoped = dynamic_pointer_cast(yyvsp[0]); @@ -3108,45 +3009,45 @@ YYLTYPE yylloc = yyloc_default; } yyval = interfaces; } -#line 3112 "src/Slice/Grammar.cpp" +#line 3013 "src/Slice/Grammar.cpp" break; - case 91: /* interface_list: "Object keyword" */ -#line 1202 "src/Slice/Grammar.y" + case 88: /* interface_list: "Object keyword" */ +#line 1113 "src/Slice/Grammar.y" { currentUnit->error("illegal inheritance from type Object"); yyval = make_shared(); // Dummy } -#line 3121 "src/Slice/Grammar.cpp" +#line 3022 "src/Slice/Grammar.cpp" break; - case 92: /* interface_list: "Value keyword" */ -#line 1207 "src/Slice/Grammar.y" + case 89: /* interface_list: "Value keyword" */ +#line 1118 "src/Slice/Grammar.y" { currentUnit->error("illegal inheritance from type Value"); yyval = make_shared(); // Dummy } -#line 3130 "src/Slice/Grammar.cpp" +#line 3031 "src/Slice/Grammar.cpp" break; - case 93: /* interface_extends: extends interface_list */ -#line 1217 "src/Slice/Grammar.y" + case 90: /* interface_extends: extends interface_list */ +#line 1128 "src/Slice/Grammar.y" { yyval = yyvsp[0]; } -#line 3138 "src/Slice/Grammar.cpp" +#line 3039 "src/Slice/Grammar.cpp" break; - case 94: /* interface_extends: %empty */ -#line 1221 "src/Slice/Grammar.y" + case 91: /* interface_extends: %empty */ +#line 1132 "src/Slice/Grammar.y" { yyval = make_shared(); } -#line 3146 "src/Slice/Grammar.cpp" +#line 3047 "src/Slice/Grammar.cpp" break; - case 95: /* operations: metadata operation ';' operations */ -#line 1230 "src/Slice/Grammar.y" + case 92: /* operations: metadata operation ';' operations */ +#line 1141 "src/Slice/Grammar.y" { auto metadata = dynamic_pointer_cast(yyvsp[-3]); auto contained = dynamic_pointer_cast(yyvsp[-2]); @@ -3155,55 +3056,55 @@ YYLTYPE yylloc = yyloc_default; contained->appendMetadata(std::move(metadata->v)); } } -#line 3159 "src/Slice/Grammar.cpp" +#line 3060 "src/Slice/Grammar.cpp" break; - case 96: /* operations: error ';' operations */ -#line 1239 "src/Slice/Grammar.y" + case 93: /* operations: error ';' operations */ +#line 1150 "src/Slice/Grammar.y" { } -#line 3166 "src/Slice/Grammar.cpp" +#line 3067 "src/Slice/Grammar.cpp" break; - case 97: /* operations: metadata operation */ -#line 1242 "src/Slice/Grammar.y" + case 94: /* operations: metadata operation */ +#line 1153 "src/Slice/Grammar.y" { currentUnit->error("';' missing after definition"); } -#line 3174 "src/Slice/Grammar.cpp" +#line 3075 "src/Slice/Grammar.cpp" break; - case 98: /* operations: %empty */ -#line 1246 "src/Slice/Grammar.y" + case 95: /* operations: %empty */ +#line 1157 "src/Slice/Grammar.y" { } -#line 3181 "src/Slice/Grammar.cpp" +#line 3082 "src/Slice/Grammar.cpp" break; - case 99: /* exception_list: exception_list ',' exception */ -#line 1254 "src/Slice/Grammar.y" + case 96: /* exception_list: exception_list ',' exception */ +#line 1165 "src/Slice/Grammar.y" { auto exceptionList = dynamic_pointer_cast(yyvsp[-2]); auto exception = dynamic_pointer_cast(yyvsp[0]); exceptionList->v.push_back(exception); yyval = exceptionList; } -#line 3192 "src/Slice/Grammar.cpp" +#line 3093 "src/Slice/Grammar.cpp" break; - case 100: /* exception_list: exception */ -#line 1261 "src/Slice/Grammar.y" + case 97: /* exception_list: exception */ +#line 1172 "src/Slice/Grammar.y" { auto exceptionList = make_shared(); auto exception = dynamic_pointer_cast(yyvsp[0]); exceptionList->v.push_back(exception); yyval = exceptionList; } -#line 3203 "src/Slice/Grammar.cpp" +#line 3104 "src/Slice/Grammar.cpp" break; - case 101: /* exception: scoped_name */ -#line 1273 "src/Slice/Grammar.y" + case 98: /* exception: scoped_name */ +#line 1184 "src/Slice/Grammar.y" { auto scoped = dynamic_pointer_cast(yyvsp[0]); ContainerPtr cont = currentUnit->currentContainer(); @@ -3215,21 +3116,21 @@ YYLTYPE yylloc = yyloc_default; cont->checkHasChangedMeaning(scoped->v, exception); yyval = exception; } -#line 3219 "src/Slice/Grammar.cpp" +#line 3120 "src/Slice/Grammar.cpp" break; - case 102: /* exception: keyword */ -#line 1285 "src/Slice/Grammar.y" + case 99: /* exception: keyword */ +#line 1196 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); currentUnit->error("keyword '" + ident->v + "' cannot be used as exception name"); yyval = currentUnit->currentContainer()->createException(Ice::generateUUID(), 0, Dummy); // Dummy } -#line 3229 "src/Slice/Grammar.cpp" +#line 3130 "src/Slice/Grammar.cpp" break; - case 103: /* sequence_def: "sequence keyword" '<' metadata type '>' definition_name */ -#line 1296 "src/Slice/Grammar.y" + case 100: /* sequence_def: "sequence keyword" '<' metadata type '>' definition_name */ +#line 1207 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); auto metadata = dynamic_pointer_cast(yyvsp[-3]); @@ -3237,11 +3138,11 @@ YYLTYPE yylloc = yyloc_default; ContainerPtr cont = currentUnit->currentContainer(); yyval = cont->createSequence(ident->v, type, std::move(metadata->v)); } -#line 3241 "src/Slice/Grammar.cpp" +#line 3142 "src/Slice/Grammar.cpp" break; - case 104: /* dictionary_def: "dictionary keyword" '<' metadata type ',' metadata type '>' definition_name */ -#line 1309 "src/Slice/Grammar.y" + case 101: /* dictionary_def: "dictionary keyword" '<' metadata type ',' metadata type '>' definition_name */ +#line 1220 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); auto keyMetadata = dynamic_pointer_cast(yyvsp[-6]); @@ -3251,11 +3152,11 @@ YYLTYPE yylloc = yyloc_default; ContainerPtr cont = currentUnit->currentContainer(); yyval = cont->createDictionary(ident->v, keyType, std::move(keyMetadata->v), valueType, std::move(valueMetadata->v)); } -#line 3255 "src/Slice/Grammar.cpp" +#line 3156 "src/Slice/Grammar.cpp" break; - case 105: /* @9: %empty */ -#line 1324 "src/Slice/Grammar.y" + case 102: /* @9: %empty */ +#line 1235 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); ContainerPtr cont = currentUnit->currentContainer(); @@ -3264,11 +3165,11 @@ YYLTYPE yylloc = yyloc_default; currentUnit->pushContainer(en); yyval = en; } -#line 3268 "src/Slice/Grammar.cpp" +#line 3169 "src/Slice/Grammar.cpp" break; - case 106: /* enum_def: "enum keyword" definition_name @9 '{' enumerators '}' */ -#line 1333 "src/Slice/Grammar.y" + case 103: /* enum_def: "enum keyword" definition_name @9 '{' enumerators '}' */ +#line 1244 "src/Slice/Grammar.y" { auto en = dynamic_pointer_cast(yyvsp[-3]); auto enumerators = dynamic_pointer_cast(yyvsp[-1]); @@ -3279,27 +3180,27 @@ YYLTYPE yylloc = yyloc_default; currentUnit->popContainer(); yyval = en; } -#line 3283 "src/Slice/Grammar.cpp" +#line 3184 "src/Slice/Grammar.cpp" break; - case 108: /* enumerators: enumerator_list ',' */ -#line 1350 "src/Slice/Grammar.y" + case 105: /* enumerators: enumerator_list ',' */ +#line 1261 "src/Slice/Grammar.y" { yyval = yyvsp[-1]; } -#line 3291 "src/Slice/Grammar.cpp" +#line 3192 "src/Slice/Grammar.cpp" break; - case 109: /* enumerators: %empty */ -#line 1354 "src/Slice/Grammar.y" + case 106: /* enumerators: %empty */ +#line 1265 "src/Slice/Grammar.y" { yyval = make_shared(); // Empty list } -#line 3299 "src/Slice/Grammar.cpp" +#line 3200 "src/Slice/Grammar.cpp" break; - case 110: /* enumerator_list: enumerator_list ',' metadata enumerator */ -#line 1363 "src/Slice/Grammar.y" + case 107: /* enumerator_list: enumerator_list ',' metadata enumerator */ +#line 1274 "src/Slice/Grammar.y" { auto enumeratorList = dynamic_pointer_cast(yyvsp[-3]); auto metadata = dynamic_pointer_cast(yyvsp[-1]); @@ -3311,11 +3212,11 @@ YYLTYPE yylloc = yyloc_default; enumeratorList->v.push_back(enumerator); yyval = enumeratorList; } -#line 3315 "src/Slice/Grammar.cpp" +#line 3216 "src/Slice/Grammar.cpp" break; - case 111: /* enumerator_list: metadata enumerator */ -#line 1375 "src/Slice/Grammar.y" + case 108: /* enumerator_list: metadata enumerator */ +#line 1286 "src/Slice/Grammar.y" { auto enumeratorList = make_shared(); auto metadata = dynamic_pointer_cast(yyvsp[-1]); @@ -3327,21 +3228,21 @@ YYLTYPE yylloc = yyloc_default; enumeratorList->v.push_back(enumerator); yyval = enumeratorList; } -#line 3331 "src/Slice/Grammar.cpp" +#line 3232 "src/Slice/Grammar.cpp" break; - case 112: /* enumerator: "identifier" */ -#line 1392 "src/Slice/Grammar.y" + case 109: /* enumerator: "identifier" */ +#line 1303 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); EnumPtr cont = dynamic_pointer_cast(currentUnit->currentContainer()); yyval = cont->createEnumerator(ident->v, nullopt); } -#line 3341 "src/Slice/Grammar.cpp" +#line 3242 "src/Slice/Grammar.cpp" break; - case 113: /* enumerator: "identifier" '=' integer_constant */ -#line 1398 "src/Slice/Grammar.y" + case 110: /* enumerator: "identifier" '=' integer_constant */ +#line 1309 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[-2]); EnumPtr cont = dynamic_pointer_cast(currentUnit->currentContainer()); @@ -3357,22 +3258,22 @@ YYLTYPE yylloc = yyloc_default; yyval = cont->createEnumerator(ident->v, nullopt); // Dummy } } -#line 3361 "src/Slice/Grammar.cpp" +#line 3262 "src/Slice/Grammar.cpp" break; - case 114: /* enumerator: keyword */ -#line 1414 "src/Slice/Grammar.y" + case 111: /* enumerator: keyword */ +#line 1325 "src/Slice/Grammar.y" { auto ident = dynamic_pointer_cast(yyvsp[0]); EnumPtr cont = dynamic_pointer_cast(currentUnit->currentContainer()); currentUnit->error("keyword '" + ident->v + "' cannot be used as enumerator"); yyval = cont->createEnumerator(ident->v, nullopt); // Dummy } -#line 3372 "src/Slice/Grammar.cpp" +#line 3273 "src/Slice/Grammar.cpp" break; - case 115: /* parameter: optional_type_id */ -#line 1426 "src/Slice/Grammar.y" + case 112: /* parameter: optional_type_id */ +#line 1337 "src/Slice/Grammar.y" { auto tsp = dynamic_pointer_cast(yyvsp[0]); ParameterPtr param; @@ -3385,11 +3286,11 @@ YYLTYPE yylloc = yyloc_default; } yyval = param; } -#line 3389 "src/Slice/Grammar.cpp" +#line 3290 "src/Slice/Grammar.cpp" break; - case 116: /* parameter: type keyword */ -#line 1439 "src/Slice/Grammar.y" + case 113: /* parameter: type keyword */ +#line 1350 "src/Slice/Grammar.y" { auto type = dynamic_pointer_cast(yyvsp[-1]); auto ident = dynamic_pointer_cast(yyvsp[0]); @@ -3403,11 +3304,11 @@ YYLTYPE yylloc = yyloc_default; } yyval = param; } -#line 3407 "src/Slice/Grammar.cpp" +#line 3308 "src/Slice/Grammar.cpp" break; - case 117: /* parameter: type */ -#line 1453 "src/Slice/Grammar.y" + case 114: /* parameter: type */ +#line 1364 "src/Slice/Grammar.y" { auto type = dynamic_pointer_cast(yyvsp[0]); ParameterPtr param; @@ -3420,11 +3321,11 @@ YYLTYPE yylloc = yyloc_default; } yyval = param; } -#line 3424 "src/Slice/Grammar.cpp" +#line 3325 "src/Slice/Grammar.cpp" break; - case 118: /* parameter: "out keyword" parameter */ -#line 1466 "src/Slice/Grammar.y" + case 115: /* parameter: "out keyword" parameter */ +#line 1377 "src/Slice/Grammar.y" { if (auto param = dynamic_pointer_cast(yyvsp[0])) { @@ -3432,11 +3333,11 @@ YYLTYPE yylloc = yyloc_default; } yyval = yyvsp[0]; } -#line 3436 "src/Slice/Grammar.cpp" +#line 3337 "src/Slice/Grammar.cpp" break; - case 119: /* parameter: local_metadata parameter */ -#line 1474 "src/Slice/Grammar.y" + case 116: /* parameter: local_metadata parameter */ +#line 1385 "src/Slice/Grammar.y" { if (auto param = dynamic_pointer_cast(yyvsp[0])) { @@ -3445,144 +3346,144 @@ YYLTYPE yylloc = yyloc_default; } yyval = yyvsp[0]; } -#line 3449 "src/Slice/Grammar.cpp" +#line 3350 "src/Slice/Grammar.cpp" break; - case 124: /* throws: "throws keyword" exception_list */ -#line 1502 "src/Slice/Grammar.y" + case 121: /* throws: "throws keyword" exception_list */ +#line 1413 "src/Slice/Grammar.y" { yyval = yyvsp[0]; } -#line 3457 "src/Slice/Grammar.cpp" +#line 3358 "src/Slice/Grammar.cpp" break; - case 125: /* throws: %empty */ -#line 1506 "src/Slice/Grammar.y" + case 122: /* throws: %empty */ +#line 1417 "src/Slice/Grammar.y" { yyval = make_shared(); } -#line 3465 "src/Slice/Grammar.cpp" +#line 3366 "src/Slice/Grammar.cpp" break; - case 126: /* scoped_name: "identifier" */ -#line 1515 "src/Slice/Grammar.y" + case 123: /* scoped_name: "identifier" */ +#line 1426 "src/Slice/Grammar.y" { } -#line 3472 "src/Slice/Grammar.cpp" +#line 3373 "src/Slice/Grammar.cpp" break; - case 127: /* scoped_name: "scoped identifier" */ -#line 1518 "src/Slice/Grammar.y" + case 124: /* scoped_name: "scoped identifier" */ +#line 1429 "src/Slice/Grammar.y" { } -#line 3479 "src/Slice/Grammar.cpp" +#line 3380 "src/Slice/Grammar.cpp" break; - case 128: /* builtin: "bool keyword" */ -#line 1525 "src/Slice/Grammar.y" + case 125: /* builtin: "bool keyword" */ +#line 1436 "src/Slice/Grammar.y" {} -#line 3485 "src/Slice/Grammar.cpp" +#line 3386 "src/Slice/Grammar.cpp" break; - case 129: /* builtin: "byte keyword" */ -#line 1526 "src/Slice/Grammar.y" + case 126: /* builtin: "byte keyword" */ +#line 1437 "src/Slice/Grammar.y" {} -#line 3491 "src/Slice/Grammar.cpp" +#line 3392 "src/Slice/Grammar.cpp" break; - case 130: /* builtin: "short keyword" */ -#line 1527 "src/Slice/Grammar.y" + case 127: /* builtin: "short keyword" */ +#line 1438 "src/Slice/Grammar.y" {} -#line 3497 "src/Slice/Grammar.cpp" +#line 3398 "src/Slice/Grammar.cpp" break; - case 131: /* builtin: "int keyword" */ -#line 1528 "src/Slice/Grammar.y" + case 128: /* builtin: "int keyword" */ +#line 1439 "src/Slice/Grammar.y" {} -#line 3503 "src/Slice/Grammar.cpp" +#line 3404 "src/Slice/Grammar.cpp" break; - case 132: /* builtin: "long keyword" */ -#line 1529 "src/Slice/Grammar.y" + case 129: /* builtin: "long keyword" */ +#line 1440 "src/Slice/Grammar.y" {} -#line 3509 "src/Slice/Grammar.cpp" +#line 3410 "src/Slice/Grammar.cpp" break; - case 133: /* builtin: "float keyword" */ -#line 1530 "src/Slice/Grammar.y" + case 130: /* builtin: "float keyword" */ +#line 1441 "src/Slice/Grammar.y" {} -#line 3515 "src/Slice/Grammar.cpp" +#line 3416 "src/Slice/Grammar.cpp" break; - case 134: /* builtin: "double keyword" */ -#line 1531 "src/Slice/Grammar.y" + case 131: /* builtin: "double keyword" */ +#line 1442 "src/Slice/Grammar.y" {} -#line 3521 "src/Slice/Grammar.cpp" +#line 3422 "src/Slice/Grammar.cpp" break; - case 135: /* builtin: "string keyword" */ -#line 1532 "src/Slice/Grammar.y" + case 132: /* builtin: "string keyword" */ +#line 1443 "src/Slice/Grammar.y" {} -#line 3527 "src/Slice/Grammar.cpp" +#line 3428 "src/Slice/Grammar.cpp" break; - case 136: /* builtin: "Object keyword" */ -#line 1533 "src/Slice/Grammar.y" + case 133: /* builtin: "Object keyword" */ +#line 1444 "src/Slice/Grammar.y" {} -#line 3533 "src/Slice/Grammar.cpp" +#line 3434 "src/Slice/Grammar.cpp" break; - case 137: /* builtin: "Value keyword" */ -#line 1534 "src/Slice/Grammar.y" + case 134: /* builtin: "Value keyword" */ +#line 1445 "src/Slice/Grammar.y" {} -#line 3539 "src/Slice/Grammar.cpp" +#line 3440 "src/Slice/Grammar.cpp" break; - case 138: /* type: "Object keyword" '*' */ -#line 1540 "src/Slice/Grammar.y" + case 135: /* type: "Object keyword" '*' */ +#line 1451 "src/Slice/Grammar.y" { yyval = currentUnit->createBuiltin(Builtin::KindObjectProxy); } -#line 3547 "src/Slice/Grammar.cpp" +#line 3448 "src/Slice/Grammar.cpp" break; - case 139: /* type: builtin */ -#line 1544 "src/Slice/Grammar.y" + case 136: /* type: builtin */ +#line 1455 "src/Slice/Grammar.y" { auto typeName = dynamic_pointer_cast(yyvsp[0]); yyval = currentUnit->createBuiltin(Builtin::kindFromString(typeName->v).value()); } -#line 3556 "src/Slice/Grammar.cpp" +#line 3457 "src/Slice/Grammar.cpp" break; - case 140: /* type: scoped_name */ -#line 1549 "src/Slice/Grammar.y" + case 137: /* type: scoped_name */ +#line 1460 "src/Slice/Grammar.y" { auto scoped = dynamic_pointer_cast(yyvsp[0]); yyval = lookupTypeByName(scoped->v, false); } -#line 3565 "src/Slice/Grammar.cpp" +#line 3466 "src/Slice/Grammar.cpp" break; - case 141: /* type: scoped_name '*' */ -#line 1554 "src/Slice/Grammar.y" + case 138: /* type: scoped_name '*' */ +#line 1465 "src/Slice/Grammar.y" { auto scoped = dynamic_pointer_cast(yyvsp[-1]); yyval = lookupTypeByName(scoped->v, true); } -#line 3574 "src/Slice/Grammar.cpp" +#line 3475 "src/Slice/Grammar.cpp" break; - case 142: /* integer_constant: "integer literal" */ -#line 1564 "src/Slice/Grammar.y" + case 139: /* integer_constant: "integer literal" */ +#line 1475 "src/Slice/Grammar.y" { yyval = yyvsp[0]; } -#line 3582 "src/Slice/Grammar.cpp" +#line 3483 "src/Slice/Grammar.cpp" break; - case 143: /* integer_constant: scoped_name */ -#line 1568 "src/Slice/Grammar.y" + case 140: /* integer_constant: scoped_name */ +#line 1479 "src/Slice/Grammar.y" { auto scoped = dynamic_pointer_cast(yyvsp[0]); ContainerPtr cont = currentUnit->currentContainer(); @@ -3662,28 +3563,28 @@ YYLTYPE yylloc = yyloc_default; yyval = nullptr; } } -#line 3666 "src/Slice/Grammar.cpp" +#line 3567 "src/Slice/Grammar.cpp" break; - case 144: /* string_literal: "string literal" string_literal */ -#line 1653 "src/Slice/Grammar.y" + case 141: /* string_literal: "string literal" string_literal */ +#line 1564 "src/Slice/Grammar.y" { auto str1 = dynamic_pointer_cast(yyvsp[-1]); auto str2 = dynamic_pointer_cast(yyvsp[0]); str1->v += str2->v; } -#line 3676 "src/Slice/Grammar.cpp" +#line 3577 "src/Slice/Grammar.cpp" break; - case 145: /* string_literal: "string literal" */ -#line 1659 "src/Slice/Grammar.y" + case 142: /* string_literal: "string literal" */ +#line 1570 "src/Slice/Grammar.y" { } -#line 3683 "src/Slice/Grammar.cpp" +#line 3584 "src/Slice/Grammar.cpp" break; - case 146: /* metadata_list: metadata_list ',' string_literal */ -#line 1667 "src/Slice/Grammar.y" + case 143: /* metadata_list: metadata_list ',' string_literal */ +#line 1578 "src/Slice/Grammar.y" { auto str = dynamic_pointer_cast(yyvsp[0]); auto metadataList = dynamic_pointer_cast(yyvsp[-2]); @@ -3693,11 +3594,11 @@ YYLTYPE yylloc = yyloc_default; yyval = metadataList; } -#line 3697 "src/Slice/Grammar.cpp" +#line 3598 "src/Slice/Grammar.cpp" break; - case 147: /* metadata_list: string_literal */ -#line 1677 "src/Slice/Grammar.y" + case 144: /* metadata_list: string_literal */ +#line 1588 "src/Slice/Grammar.y" { auto str = dynamic_pointer_cast(yyvsp[0]); auto metadataList = make_shared(); @@ -3707,11 +3608,11 @@ YYLTYPE yylloc = yyloc_default; yyval = metadataList; } -#line 3711 "src/Slice/Grammar.cpp" +#line 3612 "src/Slice/Grammar.cpp" break; - case 148: /* const_initializer: "integer literal" */ -#line 1692 "src/Slice/Grammar.y" + case 145: /* const_initializer: "integer literal" */ +#line 1603 "src/Slice/Grammar.y" { BuiltinPtr type = currentUnit->createBuiltin(Builtin::KindLong); auto intVal = dynamic_pointer_cast(yyvsp[0]); @@ -3720,11 +3621,11 @@ YYLTYPE yylloc = yyloc_default; auto def = make_shared(type, sstr.str()); yyval = def; } -#line 3724 "src/Slice/Grammar.cpp" +#line 3625 "src/Slice/Grammar.cpp" break; - case 149: /* const_initializer: "floating-point literal" */ -#line 1701 "src/Slice/Grammar.y" + case 146: /* const_initializer: "floating-point literal" */ +#line 1612 "src/Slice/Grammar.y" { BuiltinPtr type = currentUnit->createBuiltin(Builtin::KindDouble); auto floatVal = dynamic_pointer_cast(yyvsp[0]); @@ -3733,11 +3634,11 @@ YYLTYPE yylloc = yyloc_default; auto def = make_shared(type, sstr.str()); yyval = def; } -#line 3737 "src/Slice/Grammar.cpp" +#line 3638 "src/Slice/Grammar.cpp" break; - case 150: /* const_initializer: scoped_name */ -#line 1710 "src/Slice/Grammar.y" + case 147: /* const_initializer: scoped_name */ +#line 1621 "src/Slice/Grammar.y" { auto scoped = dynamic_pointer_cast(yyvsp[0]); ConstDefTokPtr def; @@ -3772,44 +3673,44 @@ YYLTYPE yylloc = yyloc_default; } yyval = def; } -#line 3776 "src/Slice/Grammar.cpp" +#line 3677 "src/Slice/Grammar.cpp" break; - case 151: /* const_initializer: "string literal" */ -#line 1745 "src/Slice/Grammar.y" + case 148: /* const_initializer: "string literal" */ +#line 1656 "src/Slice/Grammar.y" { BuiltinPtr type = currentUnit->createBuiltin(Builtin::KindString); auto literal = dynamic_pointer_cast(yyvsp[0]); auto def = make_shared(type, literal->v); yyval = def; } -#line 3787 "src/Slice/Grammar.cpp" +#line 3688 "src/Slice/Grammar.cpp" break; - case 152: /* const_initializer: "false keyword" */ -#line 1752 "src/Slice/Grammar.y" + case 149: /* const_initializer: "false keyword" */ +#line 1663 "src/Slice/Grammar.y" { BuiltinPtr type = currentUnit->createBuiltin(Builtin::KindBool); auto literal = dynamic_pointer_cast(yyvsp[0]); auto def = make_shared(type, "false"); yyval = def; } -#line 3798 "src/Slice/Grammar.cpp" +#line 3699 "src/Slice/Grammar.cpp" break; - case 153: /* const_initializer: "true keyword" */ -#line 1759 "src/Slice/Grammar.y" + case 150: /* const_initializer: "true keyword" */ +#line 1670 "src/Slice/Grammar.y" { BuiltinPtr type = currentUnit->createBuiltin(Builtin::KindBool); auto literal = dynamic_pointer_cast(yyvsp[0]); auto def = make_shared(type, "true"); yyval = def; } -#line 3809 "src/Slice/Grammar.cpp" +#line 3710 "src/Slice/Grammar.cpp" break; - case 154: /* const_def: "const keyword" metadata type definition_name '=' const_initializer */ -#line 1771 "src/Slice/Grammar.y" + case 151: /* const_def: "const keyword" metadata type definition_name '=' const_initializer */ +#line 1682 "src/Slice/Grammar.y" { auto metadata = dynamic_pointer_cast(yyvsp[-4]); auto const_type = dynamic_pointer_cast(yyvsp[-3]); @@ -3818,20 +3719,20 @@ YYLTYPE yylloc = yyloc_default; yyval = currentUnit->currentContainer()->createConst(ident->v, const_type, std::move(metadata->v), value->v, value->valueAsString); } -#line 3822 "src/Slice/Grammar.cpp" +#line 3723 "src/Slice/Grammar.cpp" break; - case 155: /* definition_name: "identifier" */ -#line 1785 "src/Slice/Grammar.y" + case 152: /* definition_name: "identifier" */ +#line 1696 "src/Slice/Grammar.y" { // All good, this is a valid identifier. yyval = yyvsp[0]; } -#line 3831 "src/Slice/Grammar.cpp" +#line 3732 "src/Slice/Grammar.cpp" break; - case 156: /* definition_name: keyword */ -#line 1790 "src/Slice/Grammar.y" + case 153: /* definition_name: keyword */ +#line 1701 "src/Slice/Grammar.y" { // If an un-escaped keyword was used as an identifier, we emit an error, // but continue along, pretending like the user escaped the keyword. @@ -3839,184 +3740,205 @@ YYLTYPE yylloc = yyloc_default; currentUnit->error("keyword '" + ident->v + "' cannot be used as a name"); yyval = ident; } -#line 3843 "src/Slice/Grammar.cpp" +#line 3744 "src/Slice/Grammar.cpp" break; - case 157: /* definition_name: %empty */ -#line 1798 "src/Slice/Grammar.y" + case 154: /* definition_name: %empty */ +#line 1709 "src/Slice/Grammar.y" { // If the user forgot to give a name to a Slice definition, we emit an error, // but continue along, returning an empty string instead of an identifier. currentUnit->error("missing name"); yyval = make_shared(); } -#line 3854 "src/Slice/Grammar.cpp" +#line 3755 "src/Slice/Grammar.cpp" break; - case 158: /* keyword: "module keyword" */ -#line 1809 "src/Slice/Grammar.y" + case 155: /* definition_name_open: "identifier(" */ +#line 1721 "src/Slice/Grammar.y" +{ + // All good, this is a valid identifier. + yyval = yyvsp[0]; +} +#line 3764 "src/Slice/Grammar.cpp" + break; + + case 156: /* definition_name_open: "keyword(" */ +#line 1726 "src/Slice/Grammar.y" +{ + // If an un-escaped keyword was used as an identifier, we emit an error, + // but continue along, pretending like the user escaped the keyword. + auto ident = dynamic_pointer_cast(yyvsp[0]); + currentUnit->error("keyword '" + ident->v + "' cannot be used as a name"); + yyval = ident; +} +#line 3776 "src/Slice/Grammar.cpp" + break; + + case 157: /* keyword: "module keyword" */ +#line 1738 "src/Slice/Grammar.y" {} -#line 3860 "src/Slice/Grammar.cpp" +#line 3782 "src/Slice/Grammar.cpp" break; - case 159: /* keyword: "class keyword" */ -#line 1810 "src/Slice/Grammar.y" + case 158: /* keyword: "class keyword" */ +#line 1739 "src/Slice/Grammar.y" {} -#line 3866 "src/Slice/Grammar.cpp" +#line 3788 "src/Slice/Grammar.cpp" break; - case 160: /* keyword: "interface keyword" */ -#line 1811 "src/Slice/Grammar.y" + case 159: /* keyword: "interface keyword" */ +#line 1740 "src/Slice/Grammar.y" {} -#line 3872 "src/Slice/Grammar.cpp" +#line 3794 "src/Slice/Grammar.cpp" break; - case 161: /* keyword: "exception keyword" */ -#line 1812 "src/Slice/Grammar.y" + case 160: /* keyword: "exception keyword" */ +#line 1741 "src/Slice/Grammar.y" {} -#line 3878 "src/Slice/Grammar.cpp" +#line 3800 "src/Slice/Grammar.cpp" break; - case 162: /* keyword: "struct keyword" */ -#line 1813 "src/Slice/Grammar.y" + case 161: /* keyword: "struct keyword" */ +#line 1742 "src/Slice/Grammar.y" {} -#line 3884 "src/Slice/Grammar.cpp" +#line 3806 "src/Slice/Grammar.cpp" break; - case 163: /* keyword: "sequence keyword" */ -#line 1814 "src/Slice/Grammar.y" + case 162: /* keyword: "sequence keyword" */ +#line 1743 "src/Slice/Grammar.y" {} -#line 3890 "src/Slice/Grammar.cpp" +#line 3812 "src/Slice/Grammar.cpp" break; - case 164: /* keyword: "dictionary keyword" */ -#line 1815 "src/Slice/Grammar.y" + case 163: /* keyword: "dictionary keyword" */ +#line 1744 "src/Slice/Grammar.y" {} -#line 3896 "src/Slice/Grammar.cpp" +#line 3818 "src/Slice/Grammar.cpp" break; - case 165: /* keyword: "enum keyword" */ -#line 1816 "src/Slice/Grammar.y" + case 164: /* keyword: "enum keyword" */ +#line 1745 "src/Slice/Grammar.y" {} -#line 3902 "src/Slice/Grammar.cpp" +#line 3824 "src/Slice/Grammar.cpp" break; - case 166: /* keyword: "out keyword" */ -#line 1817 "src/Slice/Grammar.y" + case 165: /* keyword: "out keyword" */ +#line 1746 "src/Slice/Grammar.y" {} -#line 3908 "src/Slice/Grammar.cpp" +#line 3830 "src/Slice/Grammar.cpp" break; - case 167: /* keyword: "extends keyword" */ -#line 1818 "src/Slice/Grammar.y" + case 166: /* keyword: "extends keyword" */ +#line 1747 "src/Slice/Grammar.y" {} -#line 3914 "src/Slice/Grammar.cpp" +#line 3836 "src/Slice/Grammar.cpp" break; - case 168: /* keyword: "throws keyword" */ -#line 1819 "src/Slice/Grammar.y" + case 167: /* keyword: "throws keyword" */ +#line 1748 "src/Slice/Grammar.y" {} -#line 3920 "src/Slice/Grammar.cpp" +#line 3842 "src/Slice/Grammar.cpp" break; - case 169: /* keyword: "void keyword" */ -#line 1820 "src/Slice/Grammar.y" + case 168: /* keyword: "void keyword" */ +#line 1749 "src/Slice/Grammar.y" {} -#line 3926 "src/Slice/Grammar.cpp" +#line 3848 "src/Slice/Grammar.cpp" break; - case 170: /* keyword: "bool keyword" */ -#line 1821 "src/Slice/Grammar.y" + case 169: /* keyword: "bool keyword" */ +#line 1750 "src/Slice/Grammar.y" {} -#line 3932 "src/Slice/Grammar.cpp" +#line 3854 "src/Slice/Grammar.cpp" break; - case 171: /* keyword: "byte keyword" */ -#line 1822 "src/Slice/Grammar.y" + case 170: /* keyword: "byte keyword" */ +#line 1751 "src/Slice/Grammar.y" {} -#line 3938 "src/Slice/Grammar.cpp" +#line 3860 "src/Slice/Grammar.cpp" break; - case 172: /* keyword: "short keyword" */ -#line 1823 "src/Slice/Grammar.y" + case 171: /* keyword: "short keyword" */ +#line 1752 "src/Slice/Grammar.y" {} -#line 3944 "src/Slice/Grammar.cpp" +#line 3866 "src/Slice/Grammar.cpp" break; - case 173: /* keyword: "int keyword" */ -#line 1824 "src/Slice/Grammar.y" + case 172: /* keyword: "int keyword" */ +#line 1753 "src/Slice/Grammar.y" {} -#line 3950 "src/Slice/Grammar.cpp" +#line 3872 "src/Slice/Grammar.cpp" break; - case 174: /* keyword: "long keyword" */ -#line 1825 "src/Slice/Grammar.y" + case 173: /* keyword: "long keyword" */ +#line 1754 "src/Slice/Grammar.y" {} -#line 3956 "src/Slice/Grammar.cpp" +#line 3878 "src/Slice/Grammar.cpp" break; - case 175: /* keyword: "float keyword" */ -#line 1826 "src/Slice/Grammar.y" + case 174: /* keyword: "float keyword" */ +#line 1755 "src/Slice/Grammar.y" {} -#line 3962 "src/Slice/Grammar.cpp" +#line 3884 "src/Slice/Grammar.cpp" break; - case 176: /* keyword: "double keyword" */ -#line 1827 "src/Slice/Grammar.y" + case 175: /* keyword: "double keyword" */ +#line 1756 "src/Slice/Grammar.y" {} -#line 3968 "src/Slice/Grammar.cpp" +#line 3890 "src/Slice/Grammar.cpp" break; - case 177: /* keyword: "string keyword" */ -#line 1828 "src/Slice/Grammar.y" + case 176: /* keyword: "string keyword" */ +#line 1757 "src/Slice/Grammar.y" {} -#line 3974 "src/Slice/Grammar.cpp" +#line 3896 "src/Slice/Grammar.cpp" break; - case 178: /* keyword: "Object keyword" */ -#line 1829 "src/Slice/Grammar.y" + case 177: /* keyword: "Object keyword" */ +#line 1758 "src/Slice/Grammar.y" {} -#line 3980 "src/Slice/Grammar.cpp" +#line 3902 "src/Slice/Grammar.cpp" break; - case 179: /* keyword: "const keyword" */ -#line 1830 "src/Slice/Grammar.y" + case 178: /* keyword: "const keyword" */ +#line 1759 "src/Slice/Grammar.y" {} -#line 3986 "src/Slice/Grammar.cpp" +#line 3908 "src/Slice/Grammar.cpp" break; - case 180: /* keyword: "false keyword" */ -#line 1831 "src/Slice/Grammar.y" + case 179: /* keyword: "false keyword" */ +#line 1760 "src/Slice/Grammar.y" {} -#line 3992 "src/Slice/Grammar.cpp" +#line 3914 "src/Slice/Grammar.cpp" break; - case 181: /* keyword: "true keyword" */ -#line 1832 "src/Slice/Grammar.y" + case 180: /* keyword: "true keyword" */ +#line 1761 "src/Slice/Grammar.y" {} -#line 3998 "src/Slice/Grammar.cpp" +#line 3920 "src/Slice/Grammar.cpp" break; - case 182: /* keyword: "idempotent keyword" */ -#line 1833 "src/Slice/Grammar.y" + case 181: /* keyword: "idempotent keyword" */ +#line 1762 "src/Slice/Grammar.y" {} -#line 4004 "src/Slice/Grammar.cpp" +#line 3926 "src/Slice/Grammar.cpp" break; - case 183: /* keyword: "optional keyword" */ -#line 1834 "src/Slice/Grammar.y" + case 182: /* keyword: "optional keyword" */ +#line 1763 "src/Slice/Grammar.y" {} -#line 4010 "src/Slice/Grammar.cpp" +#line 3932 "src/Slice/Grammar.cpp" break; - case 184: /* keyword: "Value keyword" */ -#line 1835 "src/Slice/Grammar.y" + case 183: /* keyword: "Value keyword" */ +#line 1764 "src/Slice/Grammar.y" {} -#line 4016 "src/Slice/Grammar.cpp" +#line 3938 "src/Slice/Grammar.cpp" break; -#line 4020 "src/Slice/Grammar.cpp" +#line 3942 "src/Slice/Grammar.cpp" default: break; } @@ -4245,7 +4167,7 @@ YYLTYPE yylloc = yyloc_default; return yyresult; } -#line 1838 "src/Slice/Grammar.y" +#line 1767 "src/Slice/Grammar.y" // NOLINTEND diff --git a/cpp/src/Slice/Grammar.y b/cpp/src/Slice/Grammar.y index ec2d90f2c42..e78a2896932 100644 --- a/cpp/src/Slice/Grammar.y +++ b/cpp/src/Slice/Grammar.y @@ -309,7 +309,7 @@ definition // ---------------------------------------------------------------------- : module_def opt_semicolon { - assert($1 == nullptr || dynamic_pointer_cast($1)); + assert(dynamic_pointer_cast($1)); } | class_decl ';' { @@ -341,7 +341,7 @@ definition } | struct_def opt_semicolon { - assert($1 == nullptr || dynamic_pointer_cast($1)); + assert(dynamic_pointer_cast($1)); } | sequence_def ';' { @@ -368,35 +368,22 @@ definition // ---------------------------------------------------------------------- module_def // ---------------------------------------------------------------------- -: ICE_MODULE ICE_IDENTIFIER +: ICE_MODULE definition_name { currentUnit->setSeenDefinition(); auto ident = dynamic_pointer_cast($2); ContainerPtr cont = currentUnit->currentContainer(); ModulePtr module = cont->createModule(ident->v, false); - if (module) - { - cont->checkHasChangedMeaning(ident->v, module); - currentUnit->pushContainer(module); - $$ = module; - } - else - { - $$ = nullptr; - } + + cont->checkHasChangedMeaning(ident->v, module); + currentUnit->pushContainer(module); + $$ = module; } '{' definitions '}' { - if ($3) - { - currentUnit->popContainer(); - $$ = $3; - } - else - { - $$ = nullptr; - } + currentUnit->popContainer(); + $$ = $3; } | ICE_MODULE ICE_SCOPED_IDENTIFIER { @@ -404,7 +391,7 @@ module_def auto ident = dynamic_pointer_cast($2); - // Reject scoped identifiers starting with "::". This is generally indicates global scope, but is invalid here. + // Reject scoped identifiers starting with "::". This generally indicates global scope, but is invalid here. size_t startPos = 0; if (ident->v.find("::") == 0) { @@ -428,54 +415,35 @@ module_def { const auto currentModuleName = modules[i]; ModulePtr module = cont->createModule(currentModuleName, true); - if (module) - { - cont->checkHasChangedMeaning(currentModuleName, module); - currentUnit->pushContainer(module); - $$ = cont = module; - } - else - { - // If an error occurs while creating one of the modules, we have to stop. But, to eagerly report as many - // errors as possible, we still 'create' any remaining modules, which will run _some_ validation on them. - for (size_t j = (i + 1); j < modules.size(); j++) - { - cont->createModule(modules[j], true); // Dummy - } - // Then we roll back the chain, i.e. pop the successfully-created-modules off the container stack. - for (; i > 0; i--) - { - currentUnit->popContainer(); - } - $$ = nullptr; - break; - } + cont->checkHasChangedMeaning(currentModuleName, module); + currentUnit->pushContainer(module); + $$ = cont = module; } } '{' definitions '}' { - if ($3) - { - // We need to pop '(N+1)' modules off the container stack, to navigate out of the nested module. - // Where `N` is the number of scope separators ("::"). - size_t startPos = 0; - auto ident = dynamic_pointer_cast($2); - while ((startPos = ident->v.find("::", startPos)) != string::npos) - { - currentUnit->popContainer(); - startPos += 2; // Skip the "::" separator. - } + // We need to pop '(N+1)' modules off the container stack, to navigate out of the nested module. + // Where `N` is the number of scope separators ("::"). + size_t startPos = 0; + auto ident = dynamic_pointer_cast($2); - // Set the 'return value' to the outer-most module, before we pop it off the stack. - // Whichever module we return, is the one that metadata will be applied to. - $$ = currentUnit->currentContainer(); - currentUnit->popContainer(); + // Skip over any leading "::". This is invalid syntax of course, but the parser still needs to properly handle it. + if (ident->v.find("::") == 0) + { + startPos += 2; // Skip the leading "::". } - else + + while ((startPos = ident->v.find("::", startPos)) != string::npos) { - $$ = nullptr; + currentUnit->popContainer(); + startPos += 2; // Skip the "::" separator. } + + // Set the 'return value' to the outer-most module, before we pop it off the stack. + // Whichever module we return, is the one that metadata will be applied to. + $$ = currentUnit->currentContainer(); + currentUnit->popContainer(); } ; @@ -618,25 +586,10 @@ optional_type_id } ; -// ---------------------------------------------------------------------- -struct_id -// ---------------------------------------------------------------------- -: ICE_STRUCT ICE_IDENTIFIER -{ - $$ = $2; -} -| ICE_STRUCT keyword -{ - auto ident = dynamic_pointer_cast($2); - currentUnit->error("keyword '" + ident->v + "' cannot be used as struct name"); - $$ = $2; // Dummy -} -; - // ---------------------------------------------------------------------- struct_decl // ---------------------------------------------------------------------- -: struct_id +: ICE_STRUCT definition_name { currentUnit->error("structs cannot be forward declared"); $$ = nullptr; // Dummy @@ -646,39 +599,27 @@ struct_decl // ---------------------------------------------------------------------- struct_def // ---------------------------------------------------------------------- -: struct_id +: ICE_STRUCT definition_name { - auto ident = dynamic_pointer_cast($1); + auto ident = dynamic_pointer_cast($2); ContainerPtr cont = currentUnit->currentContainer(); StructPtr st = cont->createStruct(ident->v); - if (st) - { - cont->checkHasChangedMeaning(ident->v, st); - currentUnit->pushContainer(st); - } - else - { - st = cont->createStruct(Ice::generateUUID()); // Dummy - assert(st); - currentUnit->pushContainer(st); - } + + cont->checkHasChangedMeaning(ident->v, st); + currentUnit->pushContainer(st); $$ = st; } '{' data_members '}' { - if ($2) - { - currentUnit->popContainer(); - } - $$ = $2; + currentUnit->popContainer(); // Empty structures are not allowed - auto st = dynamic_pointer_cast($$); - assert(st); + auto st = dynamic_pointer_cast($3); if (st->dataMembers().empty()) { - currentUnit->error("struct '" + st->name() + "' must have at least one member"); // $$ is a dummy + currentUnit->error("struct '" + st->name() + "' must have at least one member"); } + $$ = st; } ; @@ -700,7 +641,7 @@ class_name // ---------------------------------------------------------------------- class_id // ---------------------------------------------------------------------- -: ICE_CLASS ICE_IDENT_OPEN integer_constant ')' +: ICE_CLASS definition_name_open integer_constant ')' { auto integer = dynamic_pointer_cast($3); int32_t id = -1; @@ -1003,7 +944,7 @@ idempotent_modifier // ---------------------------------------------------------------------- operation_preamble // ---------------------------------------------------------------------- -: idempotent_modifier return_type ICE_IDENT_OPEN +: idempotent_modifier return_type definition_name_open { bool isIdempotent = dynamic_pointer_cast($1)->v; auto returnType = dynamic_pointer_cast($2); @@ -1018,11 +959,8 @@ operation_preamble returnType->tag, isIdempotent ? Operation::Idempotent : Operation::Normal); - if (op) - { - interface->checkHasChangedMeaning(name, op); - currentUnit->pushContainer(op); - } + interface->checkHasChangedMeaning(name, op); + currentUnit->pushContainer(op); $$ = op; } else @@ -1030,33 +968,6 @@ operation_preamble $$ = nullptr; } } -| idempotent_modifier return_type ICE_KEYWORD_OPEN -{ - bool isIdempotent = dynamic_pointer_cast($1)->v; - auto returnType = dynamic_pointer_cast($2); - string name = dynamic_pointer_cast($3)->v; - auto interface = dynamic_pointer_cast(currentUnit->currentContainer()); - if (interface) - { - OperationPtr op = interface->createOperation( - name, - returnType->type, - returnType->isOptional, - returnType->tag, - isIdempotent ? Operation::Idempotent : Operation::Normal); - - if (op) - { - currentUnit->pushContainer(op); - currentUnit->error("keyword '" + name + "' cannot be used as operation name"); - } - $$ = op; // Dummy - } - else - { - $$ = nullptr; - } -} ; // ---------------------------------------------------------------------- @@ -1803,6 +1714,24 @@ definition_name } ; +// ---------------------------------------------------------------------- +definition_name_open +// ---------------------------------------------------------------------- +: ICE_IDENT_OPEN +{ + // All good, this is a valid identifier. + $$ = $1; +} +| ICE_KEYWORD_OPEN +{ + // If an un-escaped keyword was used as an identifier, we emit an error, + // but continue along, pretending like the user escaped the keyword. + auto ident = dynamic_pointer_cast($1); + currentUnit->error("keyword '" + ident->v + "' cannot be used as a name"); + $$ = ident; +} +; + // ---------------------------------------------------------------------- keyword // ---------------------------------------------------------------------- diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index d2b15deb1ac..fb6c9b7c87b 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1249,54 +1249,63 @@ Slice::Container::destroyContents() ModulePtr Slice::Container::createModule(const string& name, bool nestedSyntax) { - ContainedList matches = unit()->findContents(thisScope() + name); - matches.sort(containedCompare); // Modules can occur many times... - matches.unique(containedEqual); // ... but we only want one instance of each. + ModulePtr q = make_shared(shared_from_this(), name, nestedSyntax); - if (thisScope() == "::") + if (!name.empty()) { - unit()->addTopLevelModule(unit()->currentFile(), name); - } + if (thisScope() == "::") + { + unit()->addTopLevelModule(unit()->currentFile(), name); + } - for (const auto& p : matches) - { - bool differsOnlyInCase = matches.front()->name() != name; - ModulePtr module = dynamic_pointer_cast(p); - if (module) + bool hasConflictingIdentifier = false; + ContainedList matches = unit()->findContents(thisScope() + name); + matches.sort(containedCompare); // Modules can occur many times... + matches.unique(containedEqual); // ... but we only want one instance of each. + for (const auto& p : matches) { - if (differsOnlyInCase) // Modules can be reopened only if they are capitalized correctly. + bool differsOnlyInCase = matches.front()->name() != name; + if (ModulePtr module = dynamic_pointer_cast(p)) + { + if (differsOnlyInCase) // Modules can be reopened only if they are capitalized correctly. + { + ostringstream os; + os << "module '" << name << "' is capitalized inconsistently with its previous name: '" + << module->name() << "'"; + unit()->error(os.str()); + hasConflictingIdentifier = true; + break; + } + } + else if (!differsOnlyInCase) { ostringstream os; - os << "module '" << name << "' is capitalized inconsistently with its previous name: '" - << module->name() << "'"; + os << "redefinition of " << matches.front()->kindOf() << " '" << matches.front()->name() + << "' as module"; unit()->error(os.str()); - return nullptr; + hasConflictingIdentifier = true; + break; + } + else + { + ostringstream os; + os << "module '" << name << "' differs only in capitalization from " << matches.front()->kindOf() + << " name '" << matches.front()->name() << "'"; + unit()->error(os.str()); + hasConflictingIdentifier = true; + break; } } - else if (!differsOnlyInCase) - { - ostringstream os; - os << "redefinition of " << matches.front()->kindOf() << " '" << matches.front()->name() << "' as module"; - unit()->error(os.str()); - return nullptr; - } - else + if (!hasConflictingIdentifier) { - ostringstream os; - os << "module '" << name << "' differs only in capitalization from " << matches.front()->kindOf() - << " name '" << matches.front()->name() << "'"; - unit()->error(os.str()); - return nullptr; + // If this module has a valid identifier and doesn't conflict with another definition, + // add it to the unit's contentMap so it can be looked up later. + unit()->addContent(q); } - } - if (!checkIdentifier(name)) - { - return nullptr; + reportIllegalSuffixOrUnderscore(name); } - ModulePtr q = make_shared(shared_from_this(), name, nestedSyntax); - unit()->addContent(q); _contents.push_back(q); return q; } @@ -1348,7 +1357,7 @@ Slice::Container::createClassDef(const string& name, int32_t id, const ClassDefP return nullptr; } - if (!checkIdentifier(name) || !checkForGlobalDefinition("classes")) + if (!reportIllegalSuffixOrUnderscore(name) || !checkForGlobalDefinition("classes")) { return nullptr; } @@ -1407,7 +1416,7 @@ Slice::Container::createClassDecl(const string& name) return nullptr; } - if (!checkIdentifier(name) || !checkForGlobalDefinition("classes")) + if (!reportIllegalSuffixOrUnderscore(name) || !checkForGlobalDefinition("classes")) { return nullptr; } @@ -1482,7 +1491,7 @@ Slice::Container::createInterfaceDef(const string& name, const InterfaceList& ba return nullptr; } - if (!checkIdentifier(name) || !checkForGlobalDefinition("interfaces")) + if (!reportIllegalSuffixOrUnderscore(name) || !checkForGlobalDefinition("interfaces")) { return nullptr; } @@ -1543,7 +1552,7 @@ Slice::Container::createInterfaceDecl(const string& name) return nullptr; } - if (!checkIdentifier(name) || !checkForGlobalDefinition("interfaces")) + if (!reportIllegalSuffixOrUnderscore(name) || !checkForGlobalDefinition("interfaces")) { return nullptr; } @@ -1590,7 +1599,7 @@ Slice::Container::createException(const string& name, const ExceptionPtr& base, return nullptr; } - checkIdentifier(name); // Don't return here -- we create the exception anyway + reportIllegalSuffixOrUnderscore(name); // Don't return here -- we create the exception anyway if (nodeType == Real) { @@ -1604,36 +1613,41 @@ Slice::Container::createException(const string& name, const ExceptionPtr& base, } StructPtr -Slice::Container::createStruct(const string& name, NodeType nodeType) +Slice::Container::createStruct(const string& name) { - ContainedList matches = unit()->findContents(thisScope() + name); - if (!matches.empty()) + StructPtr p = make_shared(shared_from_this(), name); + + checkForGlobalDefinition("structs"); + + if (!name.empty()) { - if (matches.front()->name() == name) + ContainedList matches = unit()->findContents(thisScope() + name); + if (!matches.empty()) { - ostringstream os; - os << "redefinition of " << matches.front()->kindOf() << " '" << name << "' as struct"; - unit()->error(os.str()); + if (matches.front()->name() == name) + { + ostringstream os; + os << "redefinition of " << matches.front()->kindOf() << " '" << name << "' as struct"; + unit()->error(os.str()); + } + else + { + ostringstream os; + os << "struct '" << name << "' differs only in capitalization from " << matches.front()->kindOf() + << " '" << matches.front()->name() << "'"; + unit()->error(os.str()); + } } else { - ostringstream os; - os << "struct '" << name << "' differs only in capitalization from " << matches.front()->kindOf() << " '" - << matches.front()->name() << "'"; - unit()->error(os.str()); + // If this definition has a valid identifier and doesn't conflict with another definition, + // add it to the unit's contentMap so it can be looked up later. + unit()->addContent(p); } - return nullptr; - } - checkIdentifier(name); // Don't return here -- we create the struct anyway. - - if (nodeType == Real) - { - checkForGlobalDefinition("structs"); // Don't return here -- we create the struct anyway. + reportIllegalSuffixOrUnderscore(name); } - StructPtr p = make_shared(shared_from_this(), name); - unit()->addContent(p); _contents.push_back(p); return p; } @@ -1642,7 +1656,6 @@ SequencePtr Slice::Container::createSequence(const string& name, const TypePtr& type, MetadataList metadata) { SequencePtr p = make_shared(shared_from_this(), name, type, std::move(metadata)); - _contents.push_back(p); checkForGlobalDefinition("sequences"); @@ -1672,9 +1685,10 @@ Slice::Container::createSequence(const string& name, const TypePtr& type, Metada unit()->addContent(p); } - checkIdentifier(name); + reportIllegalSuffixOrUnderscore(name); } + _contents.push_back(p); return p; } @@ -1693,7 +1707,6 @@ Slice::Container::createDictionary( std::move(keyMetadata), valueType, std::move(valueMetadata)); - _contents.push_back(p); checkForGlobalDefinition("dictionaries"); if (keyType && !Dictionary::isLegalKeyType(keyType)) @@ -1727,9 +1740,10 @@ Slice::Container::createDictionary( unit()->addContent(p); } - checkIdentifier(name); + reportIllegalSuffixOrUnderscore(name); } + _contents.push_back(p); return p; } @@ -1737,7 +1751,6 @@ EnumPtr Slice::Container::createEnum(const string& name) { EnumPtr p = make_shared(shared_from_this(), name); - _contents.push_back(p); checkForGlobalDefinition("enums"); @@ -1767,9 +1780,10 @@ Slice::Container::createEnum(const string& name) unit()->addContent(p); } - checkIdentifier(name); + reportIllegalSuffixOrUnderscore(name); } + _contents.push_back(p); return p; } @@ -1785,7 +1799,6 @@ Slice::Container::createConst( validateConstant(name, type, resolvedValueType, valueString, true); ConstPtr p = make_shared(shared_from_this(), name, type, std::move(metadata), resolvedValueType, valueString); - _contents.push_back(p); checkForGlobalDefinition("constants"); @@ -1815,9 +1828,10 @@ Slice::Container::createConst( unit()->addContent(p); } - checkIdentifier(name); + reportIllegalSuffixOrUnderscore(name); } + _contents.push_back(p); return p; } @@ -2271,19 +2285,29 @@ Slice::Container::checkHasChangedMeaning(const string& name, ContainedPtr namedT } else { - // We've previously introduced the first component to the current scope, check that it has not changed meaning. - if (it->second->scoped() != namedThing->scoped()) + // If both identifiers resolve to the exact same element, then their meaning didn't change. + if (it->second->scoped() == namedThing->scoped()) { - // We don't want to issue errors for data-members or parameters. - // Since they can only exist within a self-contained scope, the only way for them to "change meaning" - // is to be redefined, which we already emit an error for elsewhere (see doesNameConflict). - auto isInSelfContainedScope = [](const ContainedPtr& p) - { return dynamic_pointer_cast(p) || dynamic_pointer_cast(p); }; + return; + } - if (!isInSelfContainedScope(it->second) && !isInSelfContainedScope(namedThing)) - { - unit()->error("'" + firstComponent + "' has changed meaning"); - } + // If the two identifiers resolve to different elements, but those elements are in the same container, + // then the 'real' error is that the user redefined an element, not that an element changed meaning. + // This error is reported elsewhere in the code, so nothing to do here. + if (it->second->container() == namedThing->container()) + { + return; + } + + // We don't want to issue errors for data-members or parameters. + // These elements always exist within a self-contained scope, the only way for them to "change meaning" + // is to be redefined, which we already emit an error for elsewhere (see doesNameConflict). + auto isInSelfContainedScope = [](const ContainedPtr& p) + { return dynamic_pointer_cast(p) || dynamic_pointer_cast(p); }; + + if (!isInSelfContainedScope(it->second) && !isInSelfContainedScope(namedThing)) + { + unit()->error("'" + firstComponent + "' has changed meaning"); } } } @@ -2658,7 +2682,7 @@ Slice::ClassDef::createDataMember( return nullptr; } - checkIdentifier(name); // Don't return here -- we create the data member anyway. + reportIllegalSuffixOrUnderscore(name); // Don't return here -- we create the data member anyway. // // Check whether any bases have defined something with the same name already. @@ -3106,53 +3130,57 @@ Slice::InterfaceDef::createOperation( int32_t tag, Operation::Mode mode) { - if (doesNameConflict(name, "operation", _contents)) - { - return nullptr; - } + OperationPtr op = make_shared(shared_from_this(), name, returnType, isOptional, tag, mode); - // Check whether enclosing interface has the same name. - if (name == this->name()) + if (!name.empty()) { - ostringstream os; - os << "interface name '" << name << "' cannot be used as operation name"; - unit()->error(os.str()); - return nullptr; - } + bool hasConflictingIdentifier = doesNameConflict(name, "operation", _contents); - string newName = IceInternal::toLower(name); - string thisName = IceInternal::toLower(this->name()); - if (newName == thisName) - { - ostringstream os; - os << "operation '" << name << "' differs only in capitalization from enclosing interface name '" - << this->name() << "'"; - unit()->error(os.str()); - return nullptr; - } + // Check whether enclosing interface has the same name. + if (name == this->name()) + { + ostringstream os; + os << "interface name '" << name << "' cannot be used as operation name"; + unit()->error(os.str()); + hasConflictingIdentifier = true; + } + else if (IceInternal::toLower(name) == IceInternal::toLower(this->name())) + { + ostringstream os; + os << "operation '" << name << "' differs only in capitalization from enclosing interface name '" + << this->name() << "'"; + unit()->error(os.str()); + hasConflictingIdentifier = true; + } - // Check whether any base has an operation with the same name already - for (const auto& baseInterface : _bases) - { - vector baseNames; - for (const auto& op : baseInterface->allOperations()) + // Check whether any base has an operation with the same name already + for (const auto& baseInterface : _bases) { - baseNames.push_back(op->name()); + vector baseNames; + for (const auto& baseOp : baseInterface->allOperations()) + { + baseNames.push_back(baseOp->name()); + } + if (!checkBaseOperationNames(name, baseNames)) + { + hasConflictingIdentifier = true; + break; + } } - if (!checkBaseOperationNames(name, baseNames)) + // Check the operations of the Object pseudo-interface. + if (!checkBaseOperationNames(name, {"ice_id", "ice_ids", "ice_ping", "ice_isA"})) { - return nullptr; + hasConflictingIdentifier = true; } - } - // Check the operations of the Object pseudo-interface. - if (!checkBaseOperationNames(name, {"ice_id", "ice_ids", "ice_ping", "ice_isA"})) - { - return nullptr; + if (!hasConflictingIdentifier) + { + // If this operation has a valid identifier and doesn't conflict with another definition, + // add it to the unit's contentMap so it can be looked up later. + unit()->addContent(op); + } } - OperationPtr op = make_shared(shared_from_this(), name, returnType, isOptional, tag, mode); - unit()->addContent(op); _contents.push_back(op); return op; } @@ -3377,7 +3405,7 @@ Slice::Operation::createParameter(const string& name, const TypePtr& type, bool return nullptr; } - checkIdentifier(name); // Don't return here -- we create the parameter anyway. + reportIllegalSuffixOrUnderscore(name); // Don't return here -- we create the parameter anyway. if (isOptional) { @@ -3761,7 +3789,7 @@ Slice::Exception::createDataMember( return nullptr; } - checkIdentifier(name); // Don't return here -- we create the data member anyway. + reportIllegalSuffixOrUnderscore(name); // Don't return here -- we create the data member anyway. // Check whether any bases have defined a member with the same name already. for (const auto& q : allBases()) @@ -3978,7 +4006,7 @@ Slice::Struct::createDataMember( return nullptr; } - checkIdentifier(name); // Don't return here -- we create the data member anyway. + reportIllegalSuffixOrUnderscore(name); // Don't return here -- we create the data member anyway. // Structures cannot contain themselves. if (type && type.get() == this) @@ -4333,7 +4361,7 @@ Slice::Enum::createEnumerator(const string& name, optional explicitValu { // Validate the enumerator's name. doesNameConflict(name, "enumerator", _contents); // Ignore return value. - checkIdentifier(name); // Ignore return value. + reportIllegalSuffixOrUnderscore(name); // Ignore return value. // Determine the enumerator's value, and check that it's valid. int32_t nextValue; diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h index 9ef59b749e8..ba3238be65d 100644 --- a/cpp/src/Slice/Parser.h +++ b/cpp/src/Slice/Parser.h @@ -486,7 +486,7 @@ namespace Slice [[nodiscard]] InterfaceDeclPtr createInterfaceDecl(const std::string& name); [[nodiscard]] ExceptionPtr createException(const std::string& name, const ExceptionPtr& base, NodeType nodeType = Real); - [[nodiscard]] StructPtr createStruct(const std::string& name, NodeType nodeType = Real); + [[nodiscard]] StructPtr createStruct(const std::string& name); [[nodiscard]] SequencePtr createSequence(const std::string& name, const TypePtr& type, MetadataList metadata); [[nodiscard]] DictionaryPtr createDictionary( const std::string& name, diff --git a/cpp/src/Slice/SliceUtil.cpp b/cpp/src/Slice/SliceUtil.cpp index 669e86bbc5c..715c1db9f2b 100644 --- a/cpp/src/Slice/SliceUtil.cpp +++ b/cpp/src/Slice/SliceUtil.cpp @@ -470,7 +470,7 @@ Slice::pluralKindOf(const ContainedPtr& p) } bool -Slice::checkIdentifier(const string& identifier) +Slice::reportIllegalSuffixOrUnderscore(const string& identifier) { // check whether the identifier is scoped size_t scopeIndex = identifier.rfind("::"); diff --git a/cpp/src/Slice/Util.h b/cpp/src/Slice/Util.h index 2dc4293dbda..08672f51ff7 100644 --- a/cpp/src/Slice/Util.h +++ b/cpp/src/Slice/Util.h @@ -64,7 +64,7 @@ namespace Slice std::string pluralKindOf(const ContainedPtr& p); // Checks an identifier for illegal syntax and reports any errors that are present. - bool checkIdentifier(const std::string& identifier); + bool reportIllegalSuffixOrUnderscore(const std::string& identifier); bool isProxyType(const TypePtr& type); diff --git a/cpp/test/Slice/errorDetection/CaseInsensitive.err b/cpp/test/Slice/errorDetection/CaseInsensitive.err index 3601fd5b576..dcea41d9f40 100644 --- a/cpp/test/Slice/errorDetection/CaseInsensitive.err +++ b/cpp/test/Slice/errorDetection/CaseInsensitive.err @@ -24,10 +24,8 @@ CaseInsensitive.ice:146: dictionary 'D' differs only in capitalization from dict CaseInsensitive.ice:147: redefinition of module 'm1' as dictionary CaseInsensitive.ice:148: dictionary 'M1' differs only in capitalization from module 'm1' CaseInsensitive.ice:151: enumeration 'eN1' differs only in capitalization from enumeration 'en1' -CaseInsensitive.ice:151: 'eN1' has changed meaning CaseInsensitive.ice:152: redefinition of module 'm1' as enumeration CaseInsensitive.ice:153: enumeration 'M1' differs only in capitalization from module 'm1' -CaseInsensitive.ice:153: 'M1' has changed meaning CaseInsensitive.ice:154: enumerator 'EN1' differs only in capitalization from enumerator 'en1' CaseInsensitive.ice:167: interface name 'base' is capitalized inconsistently with its previous name: '::Test::xxx::xx::Base' CaseInsensitive.ice:168: redefinition of interface 'Derived' diff --git a/cpp/test/Slice/errorDetection/ChangedMeaning.err b/cpp/test/Slice/errorDetection/ChangedMeaning.err index 36e0dedc2cb..cb67fb20037 100644 --- a/cpp/test/Slice/errorDetection/ChangedMeaning.err +++ b/cpp/test/Slice/errorDetection/ChangedMeaning.err @@ -8,7 +8,6 @@ ChangedMeaning.ice:79: 'c2' has changed meaning ChangedMeaning.ice:96: 'CounterSeq' has changed meaning ChangedMeaning.ice:105: redefinition of parameter 'param' ChangedMeaning.ice:123: 'E' is not an exception -ChangedMeaning.ice:123: 'E' has changed meaning ChangedMeaning.ice:130: 'E' has changed meaning ChangedMeaning.ice:136: 'E' has changed meaning ChangedMeaning.ice:171: data member 'X' differs only in capitalization from data member 'x' diff --git a/cpp/test/Slice/errorDetection/ChangedMeaning.ice b/cpp/test/Slice/errorDetection/ChangedMeaning.ice index 79e89cfb988..edad62b5bf7 100644 --- a/cpp/test/Slice/errorDetection/ChangedMeaning.ice +++ b/cpp/test/Slice/errorDetection/ChangedMeaning.ice @@ -120,7 +120,7 @@ module Test { void op1() throws ::Test::E::ee1; // Nothing introduced void E(); // OK - void op2() throws E; // Changed meaning + void op2() throws E; // Not an exception } interface Blah2 diff --git a/cpp/test/Slice/errorDetection/DerivedRedefinition.err b/cpp/test/Slice/errorDetection/DerivedRedefinition.err index 6b638426be9..3026577d0c9 100644 --- a/cpp/test/Slice/errorDetection/DerivedRedefinition.err +++ b/cpp/test/Slice/errorDetection/DerivedRedefinition.err @@ -1,5 +1,6 @@ DerivedRedefinition.ice:9: operation 'ice_ping' is already defined as an operation in a base interface DerivedRedefinition.ice:14: operation 'op' is already defined as an operation in a base interface +DerivedRedefinition.ice:15: redefinition of operation 'op' DerivedRedefinition.ice:15: operation 'op' is already defined as an operation in a base interface DerivedRedefinition.ice:31: operation 'op' is already defined as an operation in a base interface DerivedRedefinition.ice:35: ambiguous multiple inheritance: 'D3' inherits operation 'op' from two or more unrelated base interfaces diff --git a/cpp/test/Slice/errorDetection/IdentAsKeyword.err b/cpp/test/Slice/errorDetection/IdentAsKeyword.err index ea1e8a700cf..5f82a558d7e 100644 --- a/cpp/test/Slice/errorDetection/IdentAsKeyword.err +++ b/cpp/test/Slice/errorDetection/IdentAsKeyword.err @@ -3,7 +3,7 @@ IdentAsKeyword.ice:7: exceptions can only be defined within a module IdentAsKeyword.ice:8: keyword 'int' cannot be used as exception name IdentAsKeyword.ice:8: exceptions can only be defined within a module IdentAsKeyword.ice:10: structs can only be defined within a module -IdentAsKeyword.ice:11: keyword 'double' cannot be used as struct name +IdentAsKeyword.ice:11: keyword 'double' cannot be used as a name IdentAsKeyword.ice:11: structs can only be defined within a module IdentAsKeyword.ice:13: structs can only be defined within a module IdentAsKeyword.ice:14: structs can only be defined within a module @@ -56,14 +56,15 @@ IdentAsKeyword.ice:54: keyword 'idempotent' cannot be used as a name IdentAsKeyword.ice:54: enums can only be defined within a module IdentAsKeyword.ice:55: enums can only be defined within a module IdentAsKeyword.ice:55: enumeration 'IDEMPOTENT' differs only in capitalization from enumeration 'idempotent' -IdentAsKeyword.ice:55: 'IDEMPOTENT' has changed meaning IdentAsKeyword.ice:57: enums can only be defined within a module IdentAsKeyword.ice:57: keyword 'long' cannot be used as enumerator IdentAsKeyword.ice:57: keyword 'byte' cannot be used as enumerator IdentAsKeyword.ice:58: enums can only be defined within a module IdentAsKeyword.ice:60: interfaces can only be defined within a module +IdentAsKeyword.ice:60: keyword 'module' cannot be used as a name IdentAsKeyword.ice:61: interfaces can only be defined within a module IdentAsKeyword.ice:63: interfaces can only be defined within a module +IdentAsKeyword.ice:63: keyword 'exception' cannot be used as a name IdentAsKeyword.ice:64: interfaces can only be defined within a module IdentAsKeyword.ice:66: interfaces can only be defined within a module IdentAsKeyword.ice:66: syntax error, unexpected out keyword diff --git a/cpp/test/Slice/errorDetection/IllegalUseOfKeyword.err b/cpp/test/Slice/errorDetection/IllegalUseOfKeyword.err index 851bdb38a2b..7d9350b7a3c 100644 --- a/cpp/test/Slice/errorDetection/IllegalUseOfKeyword.err +++ b/cpp/test/Slice/errorDetection/IllegalUseOfKeyword.err @@ -1,14 +1,14 @@ IllegalUseOfKeyword.ice:5: keyword 'module' cannot be used as exception name IllegalUseOfKeyword.ice:5: exceptions cannot be forward declared IllegalUseOfKeyword.ice:6: keyword 'void' cannot be used as exception name -IllegalUseOfKeyword.ice:11: keyword 'exception' cannot be used as struct name +IllegalUseOfKeyword.ice:11: keyword 'exception' cannot be used as a name IllegalUseOfKeyword.ice:11: structs cannot be forward declared -IllegalUseOfKeyword.ice:12: keyword 'class' cannot be used as struct name +IllegalUseOfKeyword.ice:12: keyword 'class' cannot be used as a name IllegalUseOfKeyword.ice:17: keyword 'idempotent' cannot be used as class name IllegalUseOfKeyword.ice:18: keyword 'struct' cannot be used as class name IllegalUseOfKeyword.ice:23: keyword 'interface' cannot be used as interface name IllegalUseOfKeyword.ice:24: keyword 'extends' cannot be used as interface name -IllegalUseOfKeyword.ice:31: keyword 'module' cannot be used as operation name +IllegalUseOfKeyword.ice:31: keyword 'module' cannot be used as a name IllegalUseOfKeyword.ice:33: keyword 'throws' cannot be used as parameter name IllegalUseOfKeyword.ice:33: keyword 'void' cannot be used as parameter name IllegalUseOfKeyword.ice:35: keyword 'byte' cannot be used as parameter name