@mintplayer/polyglot-target-python 0.9.7 → 0.9.9
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 +268 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/polyglot-target-python",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "MintPlayer Polyglot Python 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
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
"name": "python",
|
|
4
4
|
"capabilities": {
|
|
5
5
|
"blockLambdas": "emulated",
|
|
6
|
-
"interfaces": "emulated"
|
|
6
|
+
"interfaces": "emulated",
|
|
7
|
+
"interfaces:runtimeIdentity": "native",
|
|
8
|
+
"attributes:target.field": false,
|
|
9
|
+
"attributes:target.param": false
|
|
7
10
|
},
|
|
8
11
|
"spec": {
|
|
9
12
|
"name": "python",
|
|
@@ -57,6 +60,7 @@
|
|
|
57
60
|
"trueLit": "True",
|
|
58
61
|
"falseLit": "False",
|
|
59
62
|
"nullLit": "None",
|
|
63
|
+
"expressionOnlyLambdas": true,
|
|
60
64
|
"identifiers": {
|
|
61
65
|
"keywords": [
|
|
62
66
|
"False",
|
|
@@ -1248,6 +1252,27 @@
|
|
|
1248
1252
|
},
|
|
1249
1253
|
"Program": {
|
|
1250
1254
|
"seq": [
|
|
1255
|
+
{
|
|
1256
|
+
"case": {
|
|
1257
|
+
"when": [
|
|
1258
|
+
[
|
|
1259
|
+
{
|
|
1260
|
+
"not": {
|
|
1261
|
+
"eq": [
|
|
1262
|
+
"module.attrImportsBlock",
|
|
1263
|
+
""
|
|
1264
|
+
]
|
|
1265
|
+
}
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
"line": {
|
|
1269
|
+
"get": "module.attrImportsBlock"
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
]
|
|
1273
|
+
]
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1251
1276
|
{
|
|
1252
1277
|
"mapDecl": "module.imports",
|
|
1253
1278
|
"each": {
|
|
@@ -1255,15 +1280,56 @@
|
|
|
1255
1280
|
"case": {
|
|
1256
1281
|
"when": [
|
|
1257
1282
|
[
|
|
1258
|
-
{
|
|
1259
|
-
|
|
1283
|
+
{
|
|
1284
|
+
"eq": [
|
|
1285
|
+
"item.isNamespace",
|
|
1286
|
+
"true"
|
|
1287
|
+
]
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
"tmpl": [
|
|
1291
|
+
"import ",
|
|
1292
|
+
{
|
|
1293
|
+
"get": "item.path"
|
|
1294
|
+
},
|
|
1295
|
+
" as ",
|
|
1296
|
+
{
|
|
1297
|
+
"get": "item.ns"
|
|
1298
|
+
}
|
|
1299
|
+
]
|
|
1300
|
+
}
|
|
1260
1301
|
],
|
|
1261
1302
|
[
|
|
1262
|
-
{
|
|
1263
|
-
|
|
1303
|
+
{
|
|
1304
|
+
"not": {
|
|
1305
|
+
"eq": [
|
|
1306
|
+
"item.names",
|
|
1307
|
+
""
|
|
1308
|
+
]
|
|
1309
|
+
}
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
"tmpl": [
|
|
1313
|
+
"from ",
|
|
1314
|
+
{
|
|
1315
|
+
"get": "item.path"
|
|
1316
|
+
},
|
|
1317
|
+
" import ",
|
|
1318
|
+
{
|
|
1319
|
+
"get": "item.names"
|
|
1320
|
+
}
|
|
1321
|
+
]
|
|
1322
|
+
}
|
|
1264
1323
|
]
|
|
1265
1324
|
],
|
|
1266
|
-
"else": {
|
|
1325
|
+
"else": {
|
|
1326
|
+
"tmpl": [
|
|
1327
|
+
"import ",
|
|
1328
|
+
{
|
|
1329
|
+
"get": "item.path"
|
|
1330
|
+
}
|
|
1331
|
+
]
|
|
1332
|
+
}
|
|
1267
1333
|
}
|
|
1268
1334
|
}
|
|
1269
1335
|
}
|
|
@@ -1919,6 +1985,34 @@
|
|
|
1919
1985
|
"pyDunder": {
|
|
1920
1986
|
"case": {
|
|
1921
1987
|
"when": [
|
|
1988
|
+
[
|
|
1989
|
+
{
|
|
1990
|
+
"and": [
|
|
1991
|
+
{
|
|
1992
|
+
"eq": [
|
|
1993
|
+
"decl.opSymbol",
|
|
1994
|
+
"-"
|
|
1995
|
+
]
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
"eq": [
|
|
1999
|
+
"decl.params.count",
|
|
2000
|
+
"0"
|
|
2001
|
+
]
|
|
2002
|
+
}
|
|
2003
|
+
]
|
|
2004
|
+
},
|
|
2005
|
+
"__neg__"
|
|
2006
|
+
],
|
|
2007
|
+
[
|
|
2008
|
+
{
|
|
2009
|
+
"eq": [
|
|
2010
|
+
"decl.opSymbol",
|
|
2011
|
+
"~"
|
|
2012
|
+
]
|
|
2013
|
+
},
|
|
2014
|
+
"__invert__"
|
|
2015
|
+
],
|
|
1922
2016
|
[
|
|
1923
2017
|
{
|
|
1924
2018
|
"eq": [
|
|
@@ -2008,6 +2102,51 @@
|
|
|
2008
2102
|
]
|
|
2009
2103
|
},
|
|
2010
2104
|
"__ge__"
|
|
2105
|
+
],
|
|
2106
|
+
[
|
|
2107
|
+
{
|
|
2108
|
+
"eq": [
|
|
2109
|
+
"decl.opSymbol",
|
|
2110
|
+
"&"
|
|
2111
|
+
]
|
|
2112
|
+
},
|
|
2113
|
+
"__and__"
|
|
2114
|
+
],
|
|
2115
|
+
[
|
|
2116
|
+
{
|
|
2117
|
+
"eq": [
|
|
2118
|
+
"decl.opSymbol",
|
|
2119
|
+
"|"
|
|
2120
|
+
]
|
|
2121
|
+
},
|
|
2122
|
+
"__or__"
|
|
2123
|
+
],
|
|
2124
|
+
[
|
|
2125
|
+
{
|
|
2126
|
+
"eq": [
|
|
2127
|
+
"decl.opSymbol",
|
|
2128
|
+
"^"
|
|
2129
|
+
]
|
|
2130
|
+
},
|
|
2131
|
+
"__xor__"
|
|
2132
|
+
],
|
|
2133
|
+
[
|
|
2134
|
+
{
|
|
2135
|
+
"eq": [
|
|
2136
|
+
"decl.opSymbol",
|
|
2137
|
+
"<<"
|
|
2138
|
+
]
|
|
2139
|
+
},
|
|
2140
|
+
"__lshift__"
|
|
2141
|
+
],
|
|
2142
|
+
[
|
|
2143
|
+
{
|
|
2144
|
+
"eq": [
|
|
2145
|
+
"decl.opSymbol",
|
|
2146
|
+
">>"
|
|
2147
|
+
]
|
|
2148
|
+
},
|
|
2149
|
+
"__rshift__"
|
|
2011
2150
|
]
|
|
2012
2151
|
],
|
|
2013
2152
|
"else": {
|
|
@@ -2306,6 +2445,48 @@
|
|
|
2306
2445
|
"}"
|
|
2307
2446
|
]
|
|
2308
2447
|
},
|
|
2448
|
+
"IsTest": {
|
|
2449
|
+
"tmpl": [
|
|
2450
|
+
"isinstance(",
|
|
2451
|
+
{ "emit": "node.operand" },
|
|
2452
|
+
", ",
|
|
2453
|
+
{ "type": "node.testType" },
|
|
2454
|
+
")"
|
|
2455
|
+
]
|
|
2456
|
+
},
|
|
2457
|
+
"AsCast": {
|
|
2458
|
+
"case": {
|
|
2459
|
+
"when": [
|
|
2460
|
+
[
|
|
2461
|
+
{ "eq": [ "node.operandIsSimple", "true" ] },
|
|
2462
|
+
{
|
|
2463
|
+
"tmpl": [
|
|
2464
|
+
"(",
|
|
2465
|
+
{ "emit": "node.operand" },
|
|
2466
|
+
" if isinstance(",
|
|
2467
|
+
{ "emit": "node.operand" },
|
|
2468
|
+
", ",
|
|
2469
|
+
{ "type": "node.castType" },
|
|
2470
|
+
") else None)"
|
|
2471
|
+
]
|
|
2472
|
+
}
|
|
2473
|
+
]
|
|
2474
|
+
],
|
|
2475
|
+
"else": {
|
|
2476
|
+
"tmpl": [
|
|
2477
|
+
"(",
|
|
2478
|
+
{ "get": "node.tempName" },
|
|
2479
|
+
" if isinstance((",
|
|
2480
|
+
{ "get": "node.tempName" },
|
|
2481
|
+
" := ",
|
|
2482
|
+
{ "emit": "node.operand" },
|
|
2483
|
+
"), ",
|
|
2484
|
+
{ "type": "node.castType" },
|
|
2485
|
+
") else None)"
|
|
2486
|
+
]
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
},
|
|
2309
2490
|
"Unary": {
|
|
2310
2491
|
"case": {
|
|
2311
2492
|
"when": [
|
|
@@ -2378,6 +2559,24 @@
|
|
|
2378
2559
|
"Cast": {
|
|
2379
2560
|
"case": {
|
|
2380
2561
|
"when": [
|
|
2562
|
+
[
|
|
2563
|
+
{
|
|
2564
|
+
"has": "node.convMethod"
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
"tmpl": [
|
|
2568
|
+
{
|
|
2569
|
+
"emitChild": "node.operand",
|
|
2570
|
+
"side": "recv"
|
|
2571
|
+
},
|
|
2572
|
+
".",
|
|
2573
|
+
{
|
|
2574
|
+
"get": "node.convMethod"
|
|
2575
|
+
},
|
|
2576
|
+
"()"
|
|
2577
|
+
]
|
|
2578
|
+
}
|
|
2579
|
+
],
|
|
2381
2580
|
[
|
|
2382
2581
|
{
|
|
2383
2582
|
"and": [
|
|
@@ -3178,6 +3377,66 @@
|
|
|
3178
3377
|
"Binary": {
|
|
3179
3378
|
"case": {
|
|
3180
3379
|
"when": [
|
|
3380
|
+
[
|
|
3381
|
+
{
|
|
3382
|
+
"and": [
|
|
3383
|
+
{
|
|
3384
|
+
"or": [
|
|
3385
|
+
{
|
|
3386
|
+
"eq": [
|
|
3387
|
+
"node.op",
|
|
3388
|
+
"=="
|
|
3389
|
+
]
|
|
3390
|
+
},
|
|
3391
|
+
{
|
|
3392
|
+
"eq": [
|
|
3393
|
+
"node.op",
|
|
3394
|
+
"!="
|
|
3395
|
+
]
|
|
3396
|
+
}
|
|
3397
|
+
]
|
|
3398
|
+
},
|
|
3399
|
+
{
|
|
3400
|
+
"eq": [
|
|
3401
|
+
"node.rhsIsNull",
|
|
3402
|
+
"true"
|
|
3403
|
+
]
|
|
3404
|
+
}
|
|
3405
|
+
]
|
|
3406
|
+
},
|
|
3407
|
+
{
|
|
3408
|
+
"case": {
|
|
3409
|
+
"when": [
|
|
3410
|
+
[
|
|
3411
|
+
{
|
|
3412
|
+
"eq": [
|
|
3413
|
+
"node.op",
|
|
3414
|
+
"=="
|
|
3415
|
+
]
|
|
3416
|
+
},
|
|
3417
|
+
{
|
|
3418
|
+
"tmpl": [
|
|
3419
|
+
{
|
|
3420
|
+
"emitChild": "node.lhs",
|
|
3421
|
+
"side": "l"
|
|
3422
|
+
},
|
|
3423
|
+
" is None"
|
|
3424
|
+
]
|
|
3425
|
+
}
|
|
3426
|
+
]
|
|
3427
|
+
],
|
|
3428
|
+
"else": {
|
|
3429
|
+
"tmpl": [
|
|
3430
|
+
{
|
|
3431
|
+
"emitChild": "node.lhs",
|
|
3432
|
+
"side": "l"
|
|
3433
|
+
},
|
|
3434
|
+
" is not None"
|
|
3435
|
+
]
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
],
|
|
3181
3440
|
[
|
|
3182
3441
|
{
|
|
3183
3442
|
"eq": [
|
|
@@ -3500,7 +3759,7 @@
|
|
|
3500
3759
|
"std": {
|
|
3501
3760
|
"std.collections": {
|
|
3502
3761
|
"List.type": "list",
|
|
3503
|
-
"List.
|
|
3762
|
+
"List.constructor": "[]",
|
|
3504
3763
|
"List.count": "len($this)",
|
|
3505
3764
|
"List.add": "$this.append($0)",
|
|
3506
3765
|
"List.clear": "$this.clear()",
|
|
@@ -3560,11 +3819,11 @@
|
|
|
3560
3819
|
},
|
|
3561
3820
|
"std.core": {
|
|
3562
3821
|
"Error.type": "Exception",
|
|
3563
|
-
"Error.
|
|
3822
|
+
"Error.constructor": "$T($0)",
|
|
3564
3823
|
"Error.message": "str($this)",
|
|
3565
3824
|
"Iterable.type": "list",
|
|
3566
3825
|
"Array.type": "list",
|
|
3567
|
-
"Array.
|
|
3826
|
+
"Array.constructor": "[]",
|
|
3568
3827
|
"Array.count": "len($this)",
|
|
3569
3828
|
"i8.parse": "int($0)",
|
|
3570
3829
|
"i16.parse": "int($0)",
|