@magnusopera/fscript 0.80.1 → 0.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -941,16 +941,98 @@ export function parseProgramWithSourceName(sourceName, src) {
941
941
  TokenStream__SkipNewlines(stream);
942
942
  const t_6 = TokenStream__Peek(stream);
943
943
  const matchValue_22 = t_6.Kind;
944
+ let matchResult_2, raw_1, name_7;
944
945
  switch (matchValue_22.tag) {
945
946
  case 5:
946
947
  case 6:
947
948
  case 7:
948
949
  case 9: {
950
+ matchResult_2 = 0;
951
+ break;
952
+ }
953
+ case 27: {
954
+ matchResult_2 = 4;
955
+ break;
956
+ }
957
+ case 29: {
958
+ matchResult_2 = 5;
959
+ break;
960
+ }
961
+ case 43: {
962
+ matchResult_2 = 6;
963
+ break;
964
+ }
965
+ case 10: {
966
+ matchResult_2 = 7;
967
+ break;
968
+ }
969
+ case 13: {
970
+ matchResult_2 = 8;
971
+ break;
972
+ }
973
+ case 17: {
974
+ matchResult_2 = 9;
975
+ break;
976
+ }
977
+ case 21: {
978
+ matchResult_2 = 10;
979
+ break;
980
+ }
981
+ case 22: {
982
+ matchResult_2 = 11;
983
+ break;
984
+ }
985
+ case 14: {
986
+ matchResult_2 = 12;
987
+ break;
988
+ }
989
+ case 46: {
990
+ matchResult_2 = 13;
991
+ break;
992
+ }
993
+ case 47: {
994
+ matchResult_2 = 14;
995
+ break;
996
+ }
997
+ case 2: {
998
+ matchResult_2 = 15;
999
+ break;
1000
+ }
1001
+ case 3: {
1002
+ matchResult_2 = 16;
1003
+ break;
1004
+ }
1005
+ case 8: {
1006
+ matchResult_2 = 1;
1007
+ raw_1 = matchValue_22.fields[0];
1008
+ break;
1009
+ }
1010
+ case 4: {
1011
+ if (matchValue_22.fields[0] === "export") {
1012
+ if (equals(TokenStream__PeekAt_Z524259A4(stream, 1).Kind, TokenKind.Let)) {
1013
+ matchResult_2 = 2;
1014
+ }
1015
+ else {
1016
+ matchResult_2 = 3;
1017
+ name_7 = matchValue_22.fields[0];
1018
+ }
1019
+ }
1020
+ else {
1021
+ matchResult_2 = 3;
1022
+ name_7 = matchValue_22.fields[0];
1023
+ }
1024
+ break;
1025
+ }
1026
+ default:
1027
+ matchResult_2 = 17;
1028
+ }
1029
+ switch (matchResult_2) {
1030
+ case 0: {
949
1031
  const t_7 = TokenStream__Next(stream);
950
1032
  return new Expr(/* ELiteral */ 1, [parseLiteral(t_7), t_7.Span]);
951
1033
  }
952
- case 8: {
953
- const raw = matchValue_22.fields[0];
1034
+ case 1: {
1035
+ const raw = raw_1;
954
1036
  const span = TokenStream__Next(stream).Span;
955
1037
  const parts = [];
956
1038
  const text = StringBuilder_$ctor();
@@ -964,42 +1046,42 @@ export function parseProgramWithSourceName(sourceName, src) {
964
1046
  while (i_1 < raw.length) {
965
1047
  let parsed;
966
1048
  const matchValue = raw[i_1];
967
- let matchResult_2, ch_1;
1049
+ let matchResult_3, ch_1;
968
1050
  switch (matchValue) {
969
1051
  case "\\": {
970
1052
  if ((i_1 + 1) < raw.length) {
971
- matchResult_2 = 4;
1053
+ matchResult_3 = 4;
972
1054
  }
973
1055
  else {
974
- matchResult_2 = 5;
1056
+ matchResult_3 = 5;
975
1057
  ch_1 = matchValue;
976
1058
  }
977
1059
  break;
978
1060
  }
979
1061
  case "{": {
980
1062
  if (((i_1 + 1) < raw.length) && (raw[i_1 + 1] === "{")) {
981
- matchResult_2 = 0;
1063
+ matchResult_3 = 0;
982
1064
  }
983
1065
  else {
984
- matchResult_2 = 2;
1066
+ matchResult_3 = 2;
985
1067
  }
986
1068
  break;
987
1069
  }
988
1070
  case "}": {
989
1071
  if (((i_1 + 1) < raw.length) && (raw[i_1 + 1] === "}")) {
990
- matchResult_2 = 1;
1072
+ matchResult_3 = 1;
991
1073
  }
992
1074
  else {
993
- matchResult_2 = 3;
1075
+ matchResult_3 = 3;
994
1076
  }
995
1077
  break;
996
1078
  }
997
1079
  default: {
998
- matchResult_2 = 5;
1080
+ matchResult_3 = 5;
999
1081
  ch_1 = matchValue;
1000
1082
  }
1001
1083
  }
1002
- switch (matchResult_2) {
1084
+ switch (matchResult_3) {
1003
1085
  case 0: {
1004
1086
  StringBuilder__Append_244C7CD6(text, "{");
1005
1087
  i_1 = ((i_1 + 2) | 0);
@@ -1122,8 +1204,9 @@ export function parseProgramWithSourceName(sourceName, src) {
1122
1204
  flushText();
1123
1205
  return new Expr(/* EInterpolatedString */ 30, [(parts.length === 0) ? singleton(new InterpolatedPart(/* IPText */ 0, [""])) : toList(parts), span]);
1124
1206
  }
1125
- case 4: {
1126
- const name_7 = matchValue_22.fields[0];
1207
+ case 2:
1208
+ throw new ParseException(new ParseError("\'export let\' is only supported at top level", t_6.Span));
1209
+ case 3: {
1127
1210
  const t_9 = TokenStream__Next(stream);
1128
1211
  switch (name_7) {
1129
1212
  case "None":
@@ -1136,7 +1219,7 @@ export function parseProgramWithSourceName(sourceName, src) {
1136
1219
  return new Expr(/* EVar */ 2, [name_7, t_9.Span]);
1137
1220
  }
1138
1221
  }
1139
- case 27: {
1222
+ case 4: {
1140
1223
  const lp_2 = TokenStream__Next(stream);
1141
1224
  if (equals(TokenStream__Peek(stream).Kind, TokenKind.RParen)) {
1142
1225
  return new Expr(/* EUnit */ 0, [mkSpanFrom(lp_2.Span, TokenStream__Next(stream).Span)]);
@@ -1158,7 +1241,7 @@ export function parseProgramWithSourceName(sourceName, src) {
1158
1241
  }
1159
1242
  }
1160
1243
  }
1161
- case 29: {
1244
+ case 5: {
1162
1245
  const lbIndex_3 = TokenStream__get_Index(stream) | 0;
1163
1246
  const lb_3 = TokenStream__Next(stream);
1164
1247
  if (!hasNonLayoutTokenAfterOnSameLine(lbIndex_3, lb_3.Span.Start.Line)) {
@@ -1198,7 +1281,7 @@ export function parseProgramWithSourceName(sourceName, src) {
1198
1281
  }
1199
1282
  }
1200
1283
  }
1201
- case 43: {
1284
+ case 6: {
1202
1285
  const lbIndex_4 = TokenStream__get_Index(stream) | 0;
1203
1286
  const lb_4 = TokenStream__Next(stream);
1204
1287
  if (!hasNonLayoutTokenAfterOnSameLine(lbIndex_4, lb_4.Span.Start.Line)) {
@@ -1392,34 +1475,34 @@ export function parseProgramWithSourceName(sourceName, src) {
1392
1475
  }
1393
1476
  }
1394
1477
  }
1395
- case 10:
1478
+ case 7:
1396
1479
  return parseLetExpr();
1397
- case 13:
1480
+ case 8:
1398
1481
  return parseLambda();
1399
- case 17:
1482
+ case 9:
1400
1483
  return parseIf();
1401
- case 21: {
1484
+ case 10: {
1402
1485
  const raiseTok = TokenStream__Next(stream);
1403
1486
  const value_59 = parsePrimary();
1404
1487
  return new Expr(/* ERaise */ 7, [value_59, mkSpanFrom(raiseTok.Span, Ast_spanOfExpr(value_59))]);
1405
1488
  }
1406
- case 22:
1489
+ case 11:
1407
1490
  return parseFor();
1408
- case 14:
1491
+ case 12:
1409
1492
  return parseMatch();
1410
- case 46: {
1493
+ case 13: {
1411
1494
  const t_10 = TokenStream__Next(stream);
1412
1495
  const nameTok_10 = TokenStream__ExpectIdent_Z721C83C5(stream, "Expected type name after \'typeof\'");
1413
1496
  return new Expr(/* ETypeOf */ 28, [(matchValue_29 = nameTok_10.Kind, (matchValue_29.tag === 4) ? matchValue_29.fields[0] : ""), mkSpanFrom(t_10.Span, nameTok_10.Span)]);
1414
1497
  }
1415
- case 47: {
1498
+ case 14: {
1416
1499
  const t_11 = TokenStream__Next(stream);
1417
1500
  const nameTok_11 = TokenStream__ExpectIdent_Z721C83C5(stream, "Expected identifier after \'nameof\'");
1418
1501
  return new Expr(/* ENameOf */ 29, [(matchValue_30 = nameTok_11.Kind, (matchValue_30.tag === 4) ? matchValue_30.fields[0] : ""), mkSpanFrom(t_11.Span, nameTok_11.Span)]);
1419
1502
  }
1420
- case 2:
1503
+ case 15:
1421
1504
  throw new ParseException(new ParseError("Indentation error: unexpected indent in expression", t_6.Span));
1422
- case 3:
1505
+ case 16:
1423
1506
  throw new ParseException(new ParseError("Indentation error: unexpected dedent in expression", t_6.Span));
1424
1507
  default:
1425
1508
  throw new ParseException(new ParseError("Unexpected token in expression", t_6.Span));
@@ -1599,19 +1682,19 @@ export function parseProgramWithSourceName(sourceName, src) {
1599
1682
  name_14 = ((matchValue_33.tag === 4) ? matchValue_33.fields[0] : "");
1600
1683
  TokenStream__SkipNewlines(stream);
1601
1684
  const matchValue_34 = TokenStream__Peek(stream).Kind;
1602
- let matchResult_3;
1685
+ let matchResult_4;
1603
1686
  if (matchValue_34.tag === 4) {
1604
1687
  if (matchValue_34.fields[0] === "in") {
1605
- matchResult_3 = 0;
1688
+ matchResult_4 = 0;
1606
1689
  }
1607
1690
  else {
1608
- matchResult_3 = 1;
1691
+ matchResult_4 = 1;
1609
1692
  }
1610
1693
  }
1611
1694
  else {
1612
- matchResult_3 = 1;
1695
+ matchResult_4 = 1;
1613
1696
  }
1614
- switch (matchResult_3) {
1697
+ switch (matchResult_4) {
1615
1698
  case 0: {
1616
1699
  TokenStream__Next(stream);
1617
1700
  break;
@@ -1624,19 +1707,19 @@ export function parseProgramWithSourceName(sourceName, src) {
1624
1707
  const source_19 = parsePostfix();
1625
1708
  TokenStream__SkipNewlines(stream);
1626
1709
  const matchValue_35 = TokenStream__Peek(stream).Kind;
1627
- let matchResult_4;
1710
+ let matchResult_5;
1628
1711
  if (matchValue_35.tag === 4) {
1629
1712
  if (matchValue_35.fields[0] === "do") {
1630
- matchResult_4 = 0;
1713
+ matchResult_5 = 0;
1631
1714
  }
1632
1715
  else {
1633
- matchResult_4 = 1;
1716
+ matchResult_5 = 1;
1634
1717
  }
1635
1718
  }
1636
1719
  else {
1637
- matchResult_4 = 1;
1720
+ matchResult_5 = 1;
1638
1721
  }
1639
- switch (matchResult_4) {
1722
+ switch (matchResult_5) {
1640
1723
  case 0: {
1641
1724
  TokenStream__Next(stream);
1642
1725
  break;
@@ -1723,29 +1806,29 @@ export function parseProgramWithSourceName(sourceName, src) {
1723
1806
  while (!doneCases_1) {
1724
1807
  TokenStream__SkipNewlines(stream);
1725
1808
  const matchValue_37 = TokenStream__Peek(stream).Kind;
1726
- let matchResult_5;
1809
+ let matchResult_6;
1727
1810
  switch (matchValue_37.tag) {
1728
1811
  case 26: {
1729
- matchResult_5 = 0;
1812
+ matchResult_6 = 0;
1730
1813
  break;
1731
1814
  }
1732
1815
  case 3: {
1733
1816
  if (hasIndentedCaseBlock) {
1734
- matchResult_5 = 1;
1817
+ matchResult_6 = 1;
1735
1818
  }
1736
1819
  else {
1737
- matchResult_5 = 3;
1820
+ matchResult_6 = 3;
1738
1821
  }
1739
1822
  break;
1740
1823
  }
1741
1824
  case 2: {
1742
- matchResult_5 = 2;
1825
+ matchResult_6 = 2;
1743
1826
  break;
1744
1827
  }
1745
1828
  default:
1746
- matchResult_5 = 3;
1829
+ matchResult_6 = 3;
1747
1830
  }
1748
- switch (matchResult_5) {
1831
+ switch (matchResult_6) {
1749
1832
  case 0: {
1750
1833
  ensureAlignedCaseStart();
1751
1834
  parseCase_1();
@@ -1879,19 +1962,19 @@ export function parseProgramWithSourceName(sourceName, src) {
1879
1962
  }
1880
1963
  }
1881
1964
  const matchValue_43 = TokenStream__Peek(stream).Kind;
1882
- let matchResult_6;
1965
+ let matchResult_7;
1883
1966
  if (matchValue_43.tag === 4) {
1884
1967
  if (matchValue_43.fields[0] === "in") {
1885
- matchResult_6 = 0;
1968
+ matchResult_7 = 0;
1886
1969
  }
1887
1970
  else {
1888
- matchResult_6 = 1;
1971
+ matchResult_7 = 1;
1889
1972
  }
1890
1973
  }
1891
1974
  else {
1892
- matchResult_6 = 1;
1975
+ matchResult_7 = 1;
1893
1976
  }
1894
- switch (matchResult_6) {
1977
+ switch (matchResult_7) {
1895
1978
  case 0:
1896
1979
  throw new ParseException(new ParseError("\'in\' keyword is not supported", TokenStream__Peek(stream).Span));
1897
1980
  default: {
@@ -1914,19 +1997,19 @@ export function parseProgramWithSourceName(sourceName, src) {
1914
1997
  }
1915
1998
  else {
1916
1999
  const matchValue_45 = TokenStream__Peek(stream).Kind;
1917
- let matchResult_7;
2000
+ let matchResult_8;
1918
2001
  if (matchValue_45.tag === 4) {
1919
2002
  if (matchValue_45.fields[0] === "in") {
1920
- matchResult_7 = 0;
2003
+ matchResult_8 = 0;
1921
2004
  }
1922
2005
  else {
1923
- matchResult_7 = 1;
2006
+ matchResult_8 = 1;
1924
2007
  }
1925
2008
  }
1926
2009
  else {
1927
- matchResult_7 = 1;
2010
+ matchResult_8 = 1;
1928
2011
  }
1929
- switch (matchResult_7) {
2012
+ switch (matchResult_8) {
1930
2013
  case 0:
1931
2014
  throw new ParseException(new ParseError("\'in\' keyword is not supported", TokenStream__Peek(stream).Span));
1932
2015
  default: {
@@ -1974,56 +2057,56 @@ export function parseProgramWithSourceName(sourceName, src) {
1974
2057
  let col, matchValue_49;
1975
2058
  TokenStream__SkipNewlines(stream);
1976
2059
  const matchValue_47 = TokenStream__Peek(stream).Kind;
1977
- let matchResult_8;
2060
+ let matchResult_9;
1978
2061
  switch (matchValue_47.tag) {
1979
2062
  case 3: {
1980
- matchResult_8 = 0;
2063
+ matchResult_9 = 0;
1981
2064
  break;
1982
2065
  }
1983
2066
  case 28:
1984
2067
  case 30:
1985
2068
  case 44: {
1986
- matchResult_8 = 1;
2069
+ matchResult_9 = 1;
1987
2070
  break;
1988
2071
  }
1989
2072
  case 0: {
1990
- matchResult_8 = 2;
2073
+ matchResult_9 = 2;
1991
2074
  break;
1992
2075
  }
1993
2076
  case 10: {
1994
- matchResult_8 = 3;
2077
+ matchResult_9 = 3;
1995
2078
  break;
1996
2079
  }
1997
2080
  case 39: {
1998
- matchResult_8 = 4;
2081
+ matchResult_9 = 4;
1999
2082
  break;
2000
2083
  }
2001
2084
  case 42: {
2002
- matchResult_8 = 6;
2085
+ matchResult_9 = 6;
2003
2086
  break;
2004
2087
  }
2005
2088
  case 38: {
2006
2089
  if (equals(TokenStream__PeekAt_Z524259A4(stream, 1).Kind, TokenKind.Import) ? true : equals(TokenStream__PeekAt_Z524259A4(stream, 1).Kind, TokenKind.Include)) {
2007
- matchResult_8 = 5;
2090
+ matchResult_9 = 5;
2008
2091
  }
2009
2092
  else {
2010
- matchResult_8 = 8;
2093
+ matchResult_9 = 8;
2011
2094
  }
2012
2095
  break;
2013
2096
  }
2014
2097
  case 29: {
2015
2098
  if (equals(TokenStream__PeekAt_Z524259A4(stream, 1).Kind, TokenKind.Less)) {
2016
- matchResult_8 = 7;
2099
+ matchResult_9 = 7;
2017
2100
  }
2018
2101
  else {
2019
- matchResult_8 = 8;
2102
+ matchResult_9 = 8;
2020
2103
  }
2021
2104
  break;
2022
2105
  }
2023
2106
  default:
2024
- matchResult_8 = 8;
2107
+ matchResult_9 = 8;
2025
2108
  }
2026
- switch (matchResult_8) {
2109
+ switch (matchResult_9) {
2027
2110
  case 0: {
2028
2111
  TokenStream__Next(stream);
2029
2112
  TokenStream__SkipNewlines(stream);
@@ -2080,7 +2163,7 @@ export function parseProgramWithSourceName(sourceName, src) {
2080
2163
  break;
2081
2164
  }
2082
2165
  case 7: {
2083
- throw new ParseException(new ParseError("\'[<export>]\' is only supported at top level", TokenStream__Peek(stream).Span));
2166
+ throw new ParseException(new ParseError("Attributes are not supported in scripts", TokenStream__Peek(stream).Span));
2084
2167
  break;
2085
2168
  }
2086
2169
  case 8: {
@@ -2250,56 +2333,69 @@ export function parseProgramWithSourceName(sourceName, src) {
2250
2333
  return new Stmt(/* SLetPattern */ 3, [pattern_10, value_79, isExported, mkSpanFrom(letTok_1.Span, Ast_spanOfExpr(value_79))]);
2251
2334
  }
2252
2335
  };
2253
- const parseAttributeName = () => {
2254
- TokenStream__Expect_77B9EE56(stream, TokenKind.LBracket, "Expected \'[\' in attribute");
2255
- TokenStream__Expect_77B9EE56(stream, TokenKind.Less, "Expected \'<\' in attribute");
2256
- const nameTok_17 = TokenStream__ExpectIdent_Z721C83C5(stream, "Expected attribute name");
2257
- let name_20;
2258
- const matchValue_54 = nameTok_17.Kind;
2259
- name_20 = ((matchValue_54.tag === 4) ? matchValue_54.fields[0] : "");
2260
- TokenStream__Expect_77B9EE56(stream, TokenKind.Greater, "Expected \'>\' in attribute");
2261
- TokenStream__Expect_77B9EE56(stream, TokenKind.RBracket, "Expected \']\' in attribute");
2262
- return [name_20, nameTok_17.Span];
2263
- };
2264
2336
  const parseStmt = () => {
2265
- let matchValue_58;
2337
+ let matchValue_57;
2266
2338
  TokenStream__SkipNewlines(stream);
2267
- if (equals(TokenStream__Peek(stream).Kind, new TokenKind(/* Ident */ 4, ["export"])) && equals(TokenStream__PeekAt_Z524259A4(stream, 1).Kind, TokenKind.Let)) {
2268
- throw new ParseException(new ParseError("\'export let\' is no longer supported; use \'[<export>] let ...\'", TokenStream__Peek(stream).Span));
2269
- }
2270
- let isExported_1 = false;
2271
- let hasAttributes = false;
2272
- let parsingAttributes = true;
2273
- while (parsingAttributes) {
2274
- if (equals(TokenStream__Peek(stream).Kind, TokenKind.LBracket) && equals(TokenStream__PeekAt_Z524259A4(stream, 1).Kind, TokenKind.Less)) {
2275
- hasAttributes = true;
2276
- const patternInput_5 = parseAttributeName();
2277
- const span_9 = patternInput_5[1];
2278
- const name_21 = patternInput_5[0];
2279
- if (name_21 === "export") {
2280
- if (isExported_1) {
2281
- throw new ParseException(new ParseError("Duplicate attribute \'export\'", span_9));
2282
- }
2283
- isExported_1 = true;
2339
+ const matchValue_54 = TokenStream__Peek(stream).Kind;
2340
+ let matchResult_10;
2341
+ switch (matchValue_54.tag) {
2342
+ case 4: {
2343
+ if (matchValue_54.fields[0] === "export") {
2344
+ if (equals(TokenStream__PeekAt_Z524259A4(stream, 1).Kind, TokenKind.Let)) {
2345
+ matchResult_10 = 0;
2346
+ }
2347
+ else {
2348
+ matchResult_10 = 7;
2349
+ }
2284
2350
  }
2285
2351
  else {
2286
- throw new ParseException(new ParseError(concat("Unknown attribute \'", name_21, "\'"), span_9));
2352
+ matchResult_10 = 7;
2287
2353
  }
2288
- TokenStream__SkipNewlines(stream);
2354
+ break;
2289
2355
  }
2290
- else {
2291
- parsingAttributes = false;
2356
+ case 29: {
2357
+ if (equals(TokenStream__PeekAt_Z524259A4(stream, 1).Kind, TokenKind.Less)) {
2358
+ matchResult_10 = 1;
2359
+ }
2360
+ else {
2361
+ matchResult_10 = 7;
2362
+ }
2363
+ break;
2292
2364
  }
2293
- }
2294
- const matchValue_55 = TokenStream__Peek(stream).Kind;
2295
- switch (matchValue_55.tag) {
2296
2365
  case 38: {
2297
- if (hasAttributes ? true : isExported_1) {
2298
- throw new ParseException(new ParseError("Attributes are not supported on \'import\' directives", TokenStream__Peek(stream).Span));
2299
- }
2366
+ matchResult_10 = 2;
2367
+ break;
2368
+ }
2369
+ case 39: {
2370
+ matchResult_10 = 3;
2371
+ break;
2372
+ }
2373
+ case 42: {
2374
+ matchResult_10 = 4;
2375
+ break;
2376
+ }
2377
+ case 45: {
2378
+ matchResult_10 = 5;
2379
+ break;
2380
+ }
2381
+ case 10: {
2382
+ matchResult_10 = 6;
2383
+ break;
2384
+ }
2385
+ default:
2386
+ matchResult_10 = 7;
2387
+ }
2388
+ switch (matchResult_10) {
2389
+ case 0: {
2390
+ TokenStream__Next(stream);
2391
+ return parseLetStmt(true);
2392
+ }
2393
+ case 1:
2394
+ throw new ParseException(new ParseError("Attributes are not supported in scripts; use \'export let\' for exported bindings", TokenStream__Peek(stream).Span));
2395
+ case 2: {
2300
2396
  const hashTok = TokenStream__Next(stream);
2301
- const matchValue_56 = TokenStream__Next(stream).Kind;
2302
- switch (matchValue_56.tag) {
2397
+ const matchValue_55 = TokenStream__Next(stream).Kind;
2398
+ switch (matchValue_55.tag) {
2303
2399
  case 41:
2304
2400
  throw new ParseException(new ParseError("\'#include\' was removed in 0.32.0; use \'import \"file.fss\" as Alias\'", hashTok.Span));
2305
2401
  case 39:
@@ -2308,18 +2404,15 @@ export function parseProgramWithSourceName(sourceName, src) {
2308
2404
  throw new ParseException(new ParseError("Unexpected \'#\'; use \'import \"file.fss\" as Alias\'", hashTok.Span));
2309
2405
  }
2310
2406
  }
2311
- case 39: {
2312
- if (hasAttributes ? true : isExported_1) {
2313
- throw new ParseException(new ParseError("Attributes are not supported on \'import\' directives", TokenStream__Peek(stream).Span));
2314
- }
2407
+ case 3: {
2315
2408
  const importTok = TokenStream__Next(stream);
2316
2409
  const pathTok = TokenStream__Next(stream);
2317
- const matchValue_57 = pathTok.Kind;
2318
- if (matchValue_57.tag === 7) {
2319
- if (!isNullOrWhiteSpace(matchValue_57.fields[0])) {
2410
+ const matchValue_56 = pathTok.Kind;
2411
+ if (matchValue_56.tag === 7) {
2412
+ if (!isNullOrWhiteSpace(matchValue_56.fields[0])) {
2320
2413
  TokenStream__Expect_77B9EE56(stream, TokenKind.As, "Expected \'as\' in import directive. Use: import \"file.fss\" as Alias");
2321
2414
  const aliasTok = TokenStream__ExpectIdent_Z721C83C5(stream, "Expected module alias after \'as\'");
2322
- return new Stmt(/* SImport */ 1, [(matchValue_58 = aliasTok.Kind, (matchValue_58.tag === 4) ? matchValue_58.fields[0] : ""), matchValue_57.fields[0], mkSpanFrom(importTok.Span, aliasTok.Span)]);
2415
+ return new Stmt(/* SImport */ 1, [(matchValue_57 = aliasTok.Kind, (matchValue_57.tag === 4) ? matchValue_57.fields[0] : ""), matchValue_56.fields[0], mkSpanFrom(importTok.Span, aliasTok.Span)]);
2323
2416
  }
2324
2417
  else {
2325
2418
  throw new ParseException(new ParseError("Import path cannot be empty", pathTok.Span));
@@ -2329,30 +2422,21 @@ export function parseProgramWithSourceName(sourceName, src) {
2329
2422
  throw new ParseException(new ParseError("Expected string literal import path after \'import\'", pathTok.Span));
2330
2423
  }
2331
2424
  }
2332
- case 42:
2425
+ case 4:
2333
2426
  throw new ParseException(new ParseError("\'module\' declarations are not supported in scripts", TokenStream__Peek(stream).Span));
2334
- case 45: {
2335
- if (isExported_1) {
2336
- throw new ParseException(new ParseError("\'[<export>]\' is only valid for top-level let bindings", TokenStream__Peek(stream).Span));
2337
- }
2427
+ case 5:
2338
2428
  return parseTypeDecl();
2339
- }
2340
- case 10:
2341
- return parseLetStmt(isExported_1);
2429
+ case 6:
2430
+ return parseLetStmt(false);
2342
2431
  default:
2343
- if (hasAttributes) {
2344
- throw new ParseException(new ParseError("\'[<export>]\' must be followed by a top-level let binding", TokenStream__Peek(stream).Span));
2345
- }
2346
- else {
2347
- return new Stmt(/* SExpr */ 5, [parseExpr()]);
2348
- }
2432
+ return new Stmt(/* SExpr */ 5, [parseExpr()]);
2349
2433
  }
2350
2434
  };
2351
2435
  const program = [];
2352
2436
  TokenStream__SkipNewlines(stream);
2353
2437
  while (!TokenStream__get_AtEnd(stream)) {
2354
- const matchValue_59 = TokenStream__Peek(stream).Kind;
2355
- switch (matchValue_59.tag) {
2438
+ const matchValue_58 = TokenStream__Peek(stream).Kind;
2439
+ switch (matchValue_58.tag) {
2356
2440
  case 0: {
2357
2441
  TokenStream__Next(stream);
2358
2442
  break;