Skip to content

Commit

Permalink
harmonization
Browse files Browse the repository at this point in the history
  • Loading branch information
borisbat committed Oct 29, 2024
1 parent cd75d2e commit 25b9f53
Show file tree
Hide file tree
Showing 14 changed files with 14,684 additions and 13,918 deletions.
6 changes: 3 additions & 3 deletions examples/test/misc/hello_world.das
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_new_struct {
let A : Mks* = new default<Mks>; // Mks*, on heap - default values
let b : Mks* = new Mks(5); // Mks*, on heap - with constructor
let c : Mks* = new<Mks>(a=1,b=2.0); // Mks*, on heap - with values overwritten
let d : Mks*[10] = new<Mks[10]>(); // dim of 10 elements
let d : Mks*[10] = new<Mks[10]>(); // fixed_array of 10 elements
unsafe {
let j : Mks* = new<Mks>(uninitialized b=2.0); // Mks* - on heap, uninitialized, a=0, b=2.0
let h : Mks* = new default<Mks> uninitialized; // Mks* - on heap, uninitialized, a=0, b=0.0
Expand Down Expand Up @@ -210,8 +210,8 @@ def test_arrays {
let a : array<int> <- [1,2,3,4,5]; // array of integers
let c : array<int> <- array(1,2,3,4,5); // array of integers
let d : array<int> <- array<int>(1,2,3,4,5); // array of integers
let b : int[5] = dim(1,2,3,4,5); // fixed size array of integers
let e : int[5] = dim<int>(1,2,3,4,5); // fixed size array of integers
let b : int[5] = fixed_array(1,2,3,4,5); // fixed size array of integers
let e : int[5] = fixed_array<int>(1,2,3,4,5); // fixed size array of integers
let g : array<Mks> <- [ Mks(1), Mks(2,3,4) ]; // array of structures
let f : Mks[2] <- struct<Mks>(a=1,b=2.0; a=3,b=4.0);
let G : array<Mks> <- array struct<Mks>(a=1,b=2.0; a=3,b=4.0); // array of structures
Expand Down
929 changes: 466 additions & 463 deletions src/parser/ds2_lexer.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/parser/ds2_lexer.lpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void das_accept_cpp_comment ( vector<CommentReader *> & crdi, yyscan_t scanner,
<normal>"expect" return DAS_EXPECT;
<normal>"table" return DAS_TABLE;
<normal>"array" return DAS_ARRAY;
<normal>"dim" return DAS_DIM;
<normal>"fixed_array" return DAS_FIXED_ARRAY;
<normal>"default" return DAS_DEFAULT;
<normal>"iterator" return DAS_ITERATOR;
<normal>"in" return DAS_IN;
Expand Down
180 changes: 90 additions & 90 deletions src/parser/ds2_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ enum yysymbol_kind_t
YYSYMBOL_DAS_UNSAFE = 64, /* "unsafe" */
YYSYMBOL_DAS_INSCOPE = 65, /* "inscope" */
YYSYMBOL_DAS_STATIC = 66, /* "static" */
YYSYMBOL_DAS_DIM = 67, /* "dim" */
YYSYMBOL_DAS_FIXED_ARRAY = 67, /* "fixed_array" */
YYSYMBOL_DAS_DEFAULT = 68, /* "default" */
YYSYMBOL_DAS_UNINITIALIZED = 69, /* "uninitialized" */
YYSYMBOL_DAS_TBOOL = 70, /* "bool" */
Expand Down Expand Up @@ -1026,88 +1026,88 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int16 yyrline[] =
{
0, 541, 541, 542, 547, 548, 549, 550, 551, 552,
553, 554, 555, 556, 557, 558, 559, 563, 569, 570,
571, 575, 576, 580, 598, 599, 600, 601, 605, 609,
614, 623, 631, 647, 652, 660, 660, 699, 717, 721,
722, 723, 727, 730, 734, 740, 749, 752, 758, 759,
763, 767, 768, 772, 775, 781, 787, 790, 796, 797,
801, 802, 803, 812, 813, 817, 818, 824, 825, 826,
827, 828, 832, 838, 844, 850, 858, 868, 877, 884,
885, 886, 887, 888, 889, 893, 898, 906, 907, 908,
912, 913, 914, 915, 916, 917, 918, 919, 925, 928,
934, 937, 943, 944, 945, 949, 962, 980, 983, 991,
1002, 1013, 1024, 1027, 1034, 1038, 1045, 1046, 1050, 1051,
1052, 1056, 1059, 1066, 1070, 1071, 1072, 1073, 1074, 1075,
1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085,
1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095,
1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105,
1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115,
1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125,
1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135,
1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145,
1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1158, 1176,
1177, 1178, 1182, 1188, 1188, 1205, 1209, 1220, 1229, 1241,
1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251,
1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261,
1265, 1270, 1276, 1282, 1293, 1294, 1298, 1299, 1303, 1307,
1314, 1314, 1314, 1320, 1320, 1320, 1329, 1363, 1366, 1369,
1372, 1378, 1379, 1390, 1394, 1397, 1405, 1405, 1405, 1411,
1414, 1418, 1422, 1429, 1435, 1439, 1443, 1446, 1449, 1457,
1460, 1463, 1471, 1474, 1482, 1485, 1488, 1496, 1502, 1503,
1504, 1508, 1509, 1513, 1514, 1518, 1523, 1531, 1537, 1549,
1552, 1558, 1558, 1558, 1561, 1561, 1561, 1566, 1566, 1566,
1574, 1574, 1574, 1580, 1590, 1601, 1616, 1619, 1625, 1626,
1633, 1644, 1645, 1646, 1650, 1651, 1652, 1653, 1657, 1662,
1670, 1671, 1675, 1680, 1687, 1694, 1702, 1703, 1704, 1705,
1706, 1707, 1708, 1712, 1713, 1714, 1715, 1716, 1717, 1718,
1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728,
1729, 1730, 1734, 1735, 1736, 1737, 1742, 1743, 1744, 1745,
1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755,
1756, 1757, 1758, 1763, 1770, 1782, 1787, 1797, 1801, 1808,
1811, 1811, 1811, 1816, 1816, 1816, 1829, 1833, 1837, 1842,
1849, 1849, 1849, 1856, 1860, 1869, 1873, 1876, 1882, 1883,
1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893,
1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903,
1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913,
1914, 1915, 1916, 1917, 1923, 1924, 1925, 1926, 1927, 1940,
1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950,
1951, 1954, 1957, 1958, 1961, 1961, 1961, 1964, 1969, 1973,
1977, 1977, 1977, 1982, 1985, 1989, 1989, 1989, 1994, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2011,
2015, 2016, 2017, 2018, 2019, 2020, 2021, 2025, 2029, 2033,
2037, 2041, 2045, 2049, 2053, 2057, 2064, 2065, 2069, 2070,
2071, 2075, 2076, 2080, 2081, 2082, 2086, 2087, 2091, 2102,
2105, 2105, 2124, 2123, 2137, 2136, 2152, 2161, 2171, 2172,
2176, 2179, 2188, 2189, 2193, 2196, 2199, 2215, 2224, 2225,
2229, 2232, 2235, 2249, 2250, 2254, 2260, 2266, 2269, 2273,
2279, 2288, 2289, 2290, 2294, 2295, 2299, 2306, 2311, 2320,
2326, 2337, 2340, 2345, 2350, 2358, 2369, 2372, 2372, 2392,
2393, 2397, 2398, 2399, 2403, 2406, 2406, 2424, 2428, 2435,
2438, 2451, 2468, 2469, 2470, 2475, 2475, 2501, 2502, 2506,
2507, 2511, 2512, 2513, 2517, 2527, 2530, 2536, 2541, 2536,
2556, 2557, 2561, 2562, 2566, 2572, 2573, 2577, 2578, 2579,
2583, 2586, 2592, 2597, 2592, 2611, 2618, 2623, 2632, 2638,
2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658,
2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668,
2669, 2670, 2671, 2672, 2673, 2674, 2675, 2679, 2680, 2681,
2682, 2683, 2684, 2685, 2686, 2690, 2701, 2705, 2712, 2724,
2731, 2740, 2745, 2755, 2768, 2768, 2768, 2781, 2785, 2792,
2796, 2803, 2804, 2805, 2806, 2807, 2822, 2828, 2828, 2828,
2832, 2837, 2844, 2844, 2851, 2855, 2859, 2864, 2869, 2874,
2879, 2883, 2887, 2892, 2896, 2900, 2905, 2905, 2905, 2911,
2918, 2918, 2918, 2923, 2923, 2923, 2929, 2929, 2929, 2934,
2938, 2938, 2938, 2943, 2943, 2943, 2952, 2956, 2956, 2956,
2961, 2961, 2961, 2970, 2974, 2974, 2974, 2979, 2979, 2979,
2988, 2988, 2988, 2994, 2994, 2994, 3003, 3006, 3017, 3033,
3038, 3043, 3033, 3068, 3073, 3079, 3068, 3104, 3109, 3114,
3104, 3144, 3145, 3146, 3147, 3148, 3152, 3159, 3166, 3172,
3178, 3185, 3192, 3198, 3208, 3216, 3221, 3228, 3229, 3233,
3233, 3233, 3241, 3241, 3241, 3248, 3248, 3248, 3255, 3255,
3255, 3266, 3272, 3278, 3284, 3284, 3284, 3294, 3302, 3302,
3302, 3312, 3312, 3312, 3322, 3322, 3322, 3332, 3340, 3340,
3340, 3348, 3355, 3355, 3355, 3365, 3368, 3374, 3382, 3390,
3398, 3411, 3412, 3416, 3417, 3422, 3425, 3428
0, 539, 539, 540, 545, 546, 547, 548, 549, 550,
551, 552, 553, 554, 555, 556, 557, 561, 567, 568,
569, 573, 574, 578, 596, 597, 598, 599, 603, 607,
612, 621, 629, 645, 650, 658, 658, 697, 715, 719,
720, 721, 725, 728, 732, 738, 747, 750, 756, 757,
761, 765, 766, 770, 773, 779, 785, 788, 794, 795,
799, 800, 801, 810, 811, 815, 816, 822, 823, 824,
825, 826, 830, 836, 842, 848, 856, 866, 875, 882,
883, 884, 885, 886, 887, 891, 896, 904, 905, 906,
910, 911, 912, 913, 914, 915, 916, 917, 923, 926,
932, 935, 941, 942, 943, 947, 960, 978, 981, 989,
1000, 1011, 1022, 1025, 1032, 1036, 1043, 1044, 1048, 1049,
1050, 1054, 1057, 1064, 1068, 1069, 1070, 1071, 1072, 1073,
1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083,
1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093,
1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103,
1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113,
1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123,
1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133,
1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143,
1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1156, 1174,
1175, 1176, 1180, 1186, 1186, 1203, 1207, 1218, 1227, 1239,
1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249,
1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259,
1263, 1268, 1274, 1280, 1291, 1292, 1296, 1297, 1301, 1305,
1312, 1312, 1312, 1318, 1318, 1318, 1327, 1361, 1364, 1367,
1370, 1376, 1377, 1388, 1392, 1395, 1403, 1403, 1403, 1409,
1412, 1416, 1420, 1427, 1433, 1437, 1441, 1444, 1447, 1455,
1458, 1461, 1469, 1472, 1480, 1483, 1486, 1494, 1500, 1501,
1502, 1506, 1507, 1511, 1512, 1516, 1521, 1529, 1535, 1547,
1550, 1556, 1556, 1556, 1559, 1559, 1559, 1564, 1564, 1564,
1572, 1572, 1572, 1578, 1588, 1599, 1614, 1617, 1623, 1624,
1631, 1642, 1643, 1644, 1648, 1649, 1650, 1651, 1655, 1660,
1668, 1669, 1673, 1678, 1685, 1692, 1700, 1701, 1702, 1703,
1704, 1705, 1706, 1710, 1711, 1712, 1713, 1714, 1715, 1716,
1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726,
1727, 1728, 1732, 1733, 1734, 1735, 1740, 1741, 1742, 1743,
1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753,
1754, 1755, 1756, 1761, 1768, 1780, 1785, 1795, 1799, 1806,
1809, 1809, 1809, 1814, 1814, 1814, 1827, 1831, 1835, 1840,
1847, 1847, 1847, 1854, 1858, 1867, 1871, 1874, 1880, 1881,
1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891,
1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901,
1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911,
1912, 1913, 1914, 1915, 1921, 1922, 1923, 1924, 1925, 1938,
1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948,
1949, 1952, 1955, 1956, 1959, 1959, 1959, 1962, 1967, 1971,
1975, 1975, 1975, 1980, 1983, 1987, 1987, 1987, 1992, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2009,
2013, 2014, 2015, 2016, 2017, 2018, 2019, 2023, 2027, 2031,
2035, 2039, 2043, 2047, 2051, 2055, 2062, 2063, 2067, 2068,
2069, 2073, 2074, 2078, 2079, 2080, 2084, 2085, 2089, 2100,
2103, 2103, 2122, 2121, 2135, 2134, 2150, 2159, 2169, 2170,
2174, 2177, 2186, 2187, 2191, 2194, 2197, 2213, 2222, 2223,
2227, 2230, 2233, 2247, 2248, 2252, 2258, 2264, 2267, 2271,
2277, 2286, 2287, 2288, 2292, 2293, 2297, 2304, 2309, 2318,
2324, 2335, 2338, 2343, 2348, 2356, 2367, 2370, 2370, 2390,
2391, 2395, 2396, 2397, 2401, 2404, 2404, 2422, 2426, 2433,
2436, 2449, 2466, 2467, 2468, 2473, 2473, 2499, 2500, 2504,
2505, 2509, 2510, 2511, 2515, 2525, 2528, 2534, 2539, 2534,
2554, 2555, 2559, 2560, 2564, 2570, 2571, 2575, 2576, 2577,
2581, 2584, 2590, 2595, 2590, 2609, 2616, 2621, 2630, 2636,
2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656,
2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666,
2667, 2668, 2669, 2670, 2671, 2672, 2673, 2677, 2678, 2679,
2680, 2681, 2682, 2683, 2684, 2688, 2699, 2703, 2710, 2722,
2729, 2738, 2743, 2753, 2766, 2766, 2766, 2779, 2783, 2790,
2794, 2801, 2802, 2803, 2804, 2805, 2820, 2826, 2826, 2826,
2830, 2835, 2842, 2842, 2849, 2853, 2857, 2862, 2867, 2872,
2877, 2881, 2885, 2890, 2894, 2898, 2903, 2903, 2903, 2909,
2916, 2916, 2916, 2921, 2921, 2921, 2927, 2927, 2927, 2932,
2936, 2936, 2936, 2941, 2941, 2941, 2950, 2954, 2954, 2954,
2959, 2959, 2959, 2968, 2972, 2972, 2972, 2977, 2977, 2977,
2986, 2986, 2986, 2992, 2992, 2992, 3001, 3004, 3015, 3031,
3036, 3041, 3031, 3066, 3071, 3077, 3066, 3102, 3107, 3112,
3102, 3142, 3143, 3144, 3145, 3146, 3150, 3157, 3164, 3170,
3176, 3183, 3190, 3196, 3206, 3214, 3219, 3226, 3227, 3231,
3231, 3231, 3239, 3239, 3239, 3246, 3246, 3246, 3253, 3253,
3253, 3264, 3270, 3276, 3282, 3282, 3282, 3292, 3300, 3300,
3300, 3310, 3310, 3310, 3320, 3320, 3320, 3330, 3338, 3338,
3338, 3346, 3353, 3353, 3353, 3363, 3366, 3372, 3380, 3388,
3396, 3409, 3410, 3414, 3415, 3420, 3423, 3426
};
#endif

Expand Down Expand Up @@ -1136,7 +1136,7 @@ static const char *const yytname[] =
"\"continue\"", "\"where\"", "\"pass\"", "\"reinterpret\"", "\"module\"",
"\"public\"", "\"label\"", "\"goto\"", "\"implicit\"", "\"explicit\"",
"\"shared\"", "\"private\"", "\"smart_ptr\"", "\"unsafe\"",
"\"inscope\"", "\"static\"", "\"dim\"", "\"default\"",
"\"inscope\"", "\"static\"", "\"fixed_array\"", "\"default\"",
"\"uninitialized\"", "\"bool\"", "\"void\"", "\"string\"", "\"auto\"",
"\"int\"", "\"int2\"", "\"int3\"", "\"int4\"", "\"uint\"",
"\"bitfield\"", "\"uint2\"", "\"uint3\"", "\"uint4\"", "\"float\"",
Expand Down Expand Up @@ -10507,8 +10507,8 @@ YYLTYPE yylloc = yyloc_default;
}
break;

case 801: /* make_dim_decl: "dim" '(' expr_list optional_comma ')' */
{
case 801: /* make_dim_decl: "fixed_array" '(' expr_list optional_comma ')' */
{
auto mka = new ExprMakeArray(tokAt(scanner,(yylsp[-4])));
mka->values = sequenceToList((yyvsp[-2].pExpression));
mka->makeType = make_smart<TypeDecl>(Type::autoinfer);
Expand All @@ -10518,15 +10518,15 @@ YYLTYPE yylloc = yyloc_default;
break;

case 802: /* $@95: %empty */
{ yyextra->das_arrow_depth ++; }
{ yyextra->das_arrow_depth ++; }
break;

case 803: /* $@96: %empty */
{ yyextra->das_arrow_depth --; }
{ yyextra->das_arrow_depth --; }
break;

case 804: /* make_dim_decl: "dim" '<' $@95 type_declaration_no_options '>' $@96 '(' expr_list optional_comma ')' */
{
case 804: /* make_dim_decl: "fixed_array" '<' $@95 type_declaration_no_options '>' $@96 '(' expr_list optional_comma ')' */
{
auto mka = new ExprMakeArray(tokAt(scanner,(yylsp[-9])));
mka->values = sequenceToList((yyvsp[-2].pExpression));
mka->makeType = TypeDeclPtr((yyvsp[-6].pTypeDecl));
Expand Down
2 changes: 1 addition & 1 deletion src/parser/ds2_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ extern int das2_yydebug;
DAS_UNSAFE = 319, /* "unsafe" */
DAS_INSCOPE = 320, /* "inscope" */
DAS_STATIC = 321, /* "static" */
DAS_DIM = 322, /* "dim" */
DAS_FIXED_ARRAY = 322, /* "fixed_array" */
DAS_DEFAULT = 323, /* "default" */
DAS_UNINITIALIZED = 324, /* "uninitialized" */
DAS_TBOOL = 325, /* "bool" */
Expand Down
Loading

0 comments on commit 25b9f53

Please sign in to comment.