@mintplayer/polyglot-target-typescript 0.1.0 → 0.2.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.
- package/package.json +1 -1
- package/polyglot-plugin.json +236 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/polyglot-target-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "MintPlayer Polyglot TypeScript / JavaScript target — a pure-JSON language plugin (spec + emission rules + capabilities + std bindings) for the polyglot transpiler.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyglot",
|
package/polyglot-plugin.json
CHANGED
|
@@ -367,6 +367,30 @@
|
|
|
367
367
|
},
|
|
368
368
|
{
|
|
369
369
|
"get": "spec.delimited.list.close"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"case": {
|
|
373
|
+
"when": [
|
|
374
|
+
[
|
|
375
|
+
{
|
|
376
|
+
"eq": [
|
|
377
|
+
"node.elements.count",
|
|
378
|
+
"0"
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"tmpl": [
|
|
383
|
+
" as ",
|
|
384
|
+
{
|
|
385
|
+
"type": "node.elem"
|
|
386
|
+
},
|
|
387
|
+
"[]"
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
],
|
|
392
|
+
"else": ""
|
|
393
|
+
}
|
|
370
394
|
}
|
|
371
395
|
]
|
|
372
396
|
},
|
|
@@ -1129,7 +1153,7 @@
|
|
|
1129
1153
|
}
|
|
1130
1154
|
}
|
|
1131
1155
|
},
|
|
1132
|
-
"})()"
|
|
1156
|
+
"throw new Error(\"non-exhaustive match\"); })()"
|
|
1133
1157
|
]
|
|
1134
1158
|
},
|
|
1135
1159
|
"Lambda": {
|
|
@@ -1208,7 +1232,7 @@
|
|
|
1208
1232
|
{
|
|
1209
1233
|
"line": {
|
|
1210
1234
|
"tmpl": [
|
|
1211
|
-
"type ",
|
|
1235
|
+
"export type ",
|
|
1212
1236
|
{
|
|
1213
1237
|
"fn": "ident",
|
|
1214
1238
|
"args": [
|
|
@@ -1224,7 +1248,7 @@
|
|
|
1224
1248
|
{
|
|
1225
1249
|
"line": {
|
|
1226
1250
|
"tmpl": [
|
|
1227
|
-
"const ",
|
|
1251
|
+
"export const ",
|
|
1228
1252
|
{
|
|
1229
1253
|
"fn": "ident",
|
|
1230
1254
|
"args": [
|
|
@@ -1465,7 +1489,7 @@
|
|
|
1465
1489
|
},
|
|
1466
1490
|
"tsRecordHead": {
|
|
1467
1491
|
"tmpl": [
|
|
1468
|
-
"class ",
|
|
1492
|
+
"export class ",
|
|
1469
1493
|
{
|
|
1470
1494
|
"fn": "ident",
|
|
1471
1495
|
"args": [
|
|
@@ -1607,6 +1631,9 @@
|
|
|
1607
1631
|
}
|
|
1608
1632
|
]
|
|
1609
1633
|
},
|
|
1634
|
+
{
|
|
1635
|
+
"fn": "generics"
|
|
1636
|
+
},
|
|
1610
1637
|
"): boolean"
|
|
1611
1638
|
]
|
|
1612
1639
|
},
|
|
@@ -1740,6 +1767,18 @@
|
|
|
1740
1767
|
},
|
|
1741
1768
|
{
|
|
1742
1769
|
"indent": [
|
|
1770
|
+
{
|
|
1771
|
+
"case": {
|
|
1772
|
+
"when": [
|
|
1773
|
+
[
|
|
1774
|
+
{
|
|
1775
|
+
"eq": [
|
|
1776
|
+
"stmt.catchesHaveGuard",
|
|
1777
|
+
"true"
|
|
1778
|
+
]
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
"seq": [
|
|
1743
1782
|
{
|
|
1744
1783
|
"line": "let __handled = false;"
|
|
1745
1784
|
},
|
|
@@ -1885,6 +1924,188 @@
|
|
|
1885
1924
|
]
|
|
1886
1925
|
]
|
|
1887
1926
|
}
|
|
1927
|
+
}
|
|
1928
|
+
]
|
|
1929
|
+
}
|
|
1930
|
+
]
|
|
1931
|
+
],
|
|
1932
|
+
"else": {
|
|
1933
|
+
"seq": [
|
|
1934
|
+
{
|
|
1935
|
+
"mapDecl": "stmt.catches",
|
|
1936
|
+
"each": {
|
|
1937
|
+
"case": {
|
|
1938
|
+
"when": [
|
|
1939
|
+
[
|
|
1940
|
+
{
|
|
1941
|
+
"eq": [
|
|
1942
|
+
"item.hasType",
|
|
1943
|
+
"true"
|
|
1944
|
+
]
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
"seq": [
|
|
1948
|
+
{
|
|
1949
|
+
"line": {
|
|
1950
|
+
"tmpl": [
|
|
1951
|
+
{
|
|
1952
|
+
"case": {
|
|
1953
|
+
"when": [
|
|
1954
|
+
[
|
|
1955
|
+
{
|
|
1956
|
+
"eq": [
|
|
1957
|
+
"item.#",
|
|
1958
|
+
"0"
|
|
1959
|
+
]
|
|
1960
|
+
},
|
|
1961
|
+
"if ("
|
|
1962
|
+
]
|
|
1963
|
+
],
|
|
1964
|
+
"else": "else if ("
|
|
1965
|
+
}
|
|
1966
|
+
},
|
|
1967
|
+
"__e instanceof ",
|
|
1968
|
+
{
|
|
1969
|
+
"type": "item.type"
|
|
1970
|
+
},
|
|
1971
|
+
") {"
|
|
1972
|
+
]
|
|
1973
|
+
}
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
"indent": [
|
|
1977
|
+
{
|
|
1978
|
+
"case": {
|
|
1979
|
+
"when": [
|
|
1980
|
+
[
|
|
1981
|
+
{
|
|
1982
|
+
"eq": [
|
|
1983
|
+
"item.hasBinding",
|
|
1984
|
+
"true"
|
|
1985
|
+
]
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
"line": {
|
|
1989
|
+
"tmpl": [
|
|
1990
|
+
"const ",
|
|
1991
|
+
{
|
|
1992
|
+
"fn": "ident",
|
|
1993
|
+
"args": [
|
|
1994
|
+
{
|
|
1995
|
+
"get": "item.binding"
|
|
1996
|
+
}
|
|
1997
|
+
]
|
|
1998
|
+
},
|
|
1999
|
+
" = __e;"
|
|
2000
|
+
]
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
]
|
|
2004
|
+
]
|
|
2005
|
+
}
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
"stmts": "item.body"
|
|
2009
|
+
}
|
|
2010
|
+
]
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
"line": "}"
|
|
2014
|
+
}
|
|
2015
|
+
]
|
|
2016
|
+
}
|
|
2017
|
+
]
|
|
2018
|
+
],
|
|
2019
|
+
"else": {
|
|
2020
|
+
"seq": [
|
|
2021
|
+
{
|
|
2022
|
+
"line": {
|
|
2023
|
+
"tmpl": [
|
|
2024
|
+
{
|
|
2025
|
+
"case": {
|
|
2026
|
+
"when": [
|
|
2027
|
+
[
|
|
2028
|
+
{
|
|
2029
|
+
"eq": [
|
|
2030
|
+
"item.#",
|
|
2031
|
+
"0"
|
|
2032
|
+
]
|
|
2033
|
+
},
|
|
2034
|
+
""
|
|
2035
|
+
]
|
|
2036
|
+
],
|
|
2037
|
+
"else": "else "
|
|
2038
|
+
}
|
|
2039
|
+
},
|
|
2040
|
+
"{"
|
|
2041
|
+
]
|
|
2042
|
+
}
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
"indent": [
|
|
2046
|
+
{
|
|
2047
|
+
"case": {
|
|
2048
|
+
"when": [
|
|
2049
|
+
[
|
|
2050
|
+
{
|
|
2051
|
+
"eq": [
|
|
2052
|
+
"item.hasBinding",
|
|
2053
|
+
"true"
|
|
2054
|
+
]
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
"line": {
|
|
2058
|
+
"tmpl": [
|
|
2059
|
+
"const ",
|
|
2060
|
+
{
|
|
2061
|
+
"fn": "ident",
|
|
2062
|
+
"args": [
|
|
2063
|
+
{
|
|
2064
|
+
"get": "item.binding"
|
|
2065
|
+
}
|
|
2066
|
+
]
|
|
2067
|
+
},
|
|
2068
|
+
" = __e;"
|
|
2069
|
+
]
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
]
|
|
2073
|
+
]
|
|
2074
|
+
}
|
|
2075
|
+
},
|
|
2076
|
+
{
|
|
2077
|
+
"stmts": "item.body"
|
|
2078
|
+
}
|
|
2079
|
+
]
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
"line": "}"
|
|
2083
|
+
}
|
|
2084
|
+
]
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
},
|
|
2089
|
+
{
|
|
2090
|
+
"case": {
|
|
2091
|
+
"when": [
|
|
2092
|
+
[
|
|
2093
|
+
{
|
|
2094
|
+
"eq": [
|
|
2095
|
+
"stmt.hasCatchAll",
|
|
2096
|
+
"false"
|
|
2097
|
+
]
|
|
2098
|
+
},
|
|
2099
|
+
{
|
|
2100
|
+
"line": "else { throw __e; }"
|
|
2101
|
+
}
|
|
2102
|
+
]
|
|
2103
|
+
]
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
]
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
1888
2109
|
}
|
|
1889
2110
|
]
|
|
1890
2111
|
}
|
|
@@ -2095,6 +2316,7 @@
|
|
|
2095
2316
|
"each": {
|
|
2096
2317
|
"line": {
|
|
2097
2318
|
"tmpl": [
|
|
2319
|
+
"export ",
|
|
2098
2320
|
{
|
|
2099
2321
|
"case": {
|
|
2100
2322
|
"when": [
|
|
@@ -2186,6 +2408,7 @@
|
|
|
2186
2408
|
},
|
|
2187
2409
|
"tsFnSig": {
|
|
2188
2410
|
"tmpl": [
|
|
2411
|
+
"export ",
|
|
2189
2412
|
{
|
|
2190
2413
|
"case": {
|
|
2191
2414
|
"when": [
|
|
@@ -2268,7 +2491,7 @@
|
|
|
2268
2491
|
},
|
|
2269
2492
|
"tsExtSig": {
|
|
2270
2493
|
"tmpl": [
|
|
2271
|
-
"function ",
|
|
2494
|
+
"export function ",
|
|
2272
2495
|
{
|
|
2273
2496
|
"fn": "ident",
|
|
2274
2497
|
"args": [
|
|
@@ -2333,7 +2556,7 @@
|
|
|
2333
2556
|
},
|
|
2334
2557
|
"tsClassHead": {
|
|
2335
2558
|
"tmpl": [
|
|
2336
|
-
"class ",
|
|
2559
|
+
"export class ",
|
|
2337
2560
|
{
|
|
2338
2561
|
"fn": "ident",
|
|
2339
2562
|
"args": [
|
|
@@ -2557,7 +2780,7 @@
|
|
|
2557
2780
|
"block": {
|
|
2558
2781
|
"head": {
|
|
2559
2782
|
"tmpl": [
|
|
2560
|
-
"interface ",
|
|
2783
|
+
"export interface ",
|
|
2561
2784
|
{
|
|
2562
2785
|
"fn": "ident",
|
|
2563
2786
|
"args": [
|
|
@@ -2678,7 +2901,7 @@
|
|
|
2678
2901
|
"UnionDecl": {
|
|
2679
2902
|
"line": {
|
|
2680
2903
|
"tmpl": [
|
|
2681
|
-
"type ",
|
|
2904
|
+
"export type ",
|
|
2682
2905
|
{
|
|
2683
2906
|
"fn": "ident",
|
|
2684
2907
|
"args": [
|
|
@@ -3246,11 +3469,11 @@
|
|
|
3246
3469
|
},
|
|
3247
3470
|
"std.io": {
|
|
3248
3471
|
"print": "console.log(String(x))",
|
|
3249
|
-
"readText": "
|
|
3250
|
-
"writeText": "
|
|
3251
|
-
"appendText": "
|
|
3252
|
-
"fileExists": "
|
|
3253
|
-
"deleteFile": "
|
|
3472
|
+
"readText": "process.getBuiltinModule('fs').readFileSync(path, 'utf8')",
|
|
3473
|
+
"writeText": "process.getBuiltinModule('fs').writeFileSync(path, content)",
|
|
3474
|
+
"appendText": "process.getBuiltinModule('fs').appendFileSync(path, content)",
|
|
3475
|
+
"fileExists": "process.getBuiltinModule('fs').existsSync(path)",
|
|
3476
|
+
"deleteFile": "process.getBuiltinModule('fs').unlinkSync(path)"
|
|
3254
3477
|
},
|
|
3255
3478
|
"std.math": {
|
|
3256
3479
|
"Math.PI": "Math.PI",
|