@ast-grep/lang-python 0.0.4 → 0.0.5
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 +4 -4
- package/prebuilds/prebuild-Linux-ARM64/parser.so +0 -0
- package/prebuilds/prebuild-Linux-X64/parser.so +0 -0
- package/prebuilds/prebuild-Windows-X64/parser.so +0 -0
- package/prebuilds/prebuild-macOS-ARM64/parser.so +0 -0
- package/src/grammar.json +231 -136
- package/src/node-types.json +6 -31
- package/src/parser.c +57605 -58061
- package/src/scanner.c +16 -12
- package/src/tree_sitter/parser.h +27 -7
- package/type.d.ts +6 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ast-grep/lang-python",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"author": "",
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@ast-grep/setup-lang": "0.0.
|
|
21
|
+
"@ast-grep/setup-lang": "0.0.6"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"tree-sitter-cli": "0.25.8"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ast-grep/nursery": "0.0.
|
|
32
|
+
"@ast-grep/nursery": "0.0.9",
|
|
33
33
|
"tree-sitter-cli": "0.25.8",
|
|
34
|
-
"tree-sitter-python": "0.
|
|
34
|
+
"tree-sitter-python": "0.25.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/grammar.json
CHANGED
|
@@ -1218,84 +1218,34 @@
|
|
|
1218
1218
|
"name": "_suite"
|
|
1219
1219
|
}
|
|
1220
1220
|
},
|
|
1221
|
+
{
|
|
1222
|
+
"type": "REPEAT",
|
|
1223
|
+
"content": {
|
|
1224
|
+
"type": "SYMBOL",
|
|
1225
|
+
"name": "except_clause"
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1221
1228
|
{
|
|
1222
1229
|
"type": "CHOICE",
|
|
1223
1230
|
"members": [
|
|
1224
1231
|
{
|
|
1225
|
-
"type": "
|
|
1226
|
-
"
|
|
1227
|
-
{
|
|
1228
|
-
"type": "REPEAT1",
|
|
1229
|
-
"content": {
|
|
1230
|
-
"type": "SYMBOL",
|
|
1231
|
-
"name": "except_clause"
|
|
1232
|
-
}
|
|
1233
|
-
},
|
|
1234
|
-
{
|
|
1235
|
-
"type": "CHOICE",
|
|
1236
|
-
"members": [
|
|
1237
|
-
{
|
|
1238
|
-
"type": "SYMBOL",
|
|
1239
|
-
"name": "else_clause"
|
|
1240
|
-
},
|
|
1241
|
-
{
|
|
1242
|
-
"type": "BLANK"
|
|
1243
|
-
}
|
|
1244
|
-
]
|
|
1245
|
-
},
|
|
1246
|
-
{
|
|
1247
|
-
"type": "CHOICE",
|
|
1248
|
-
"members": [
|
|
1249
|
-
{
|
|
1250
|
-
"type": "SYMBOL",
|
|
1251
|
-
"name": "finally_clause"
|
|
1252
|
-
},
|
|
1253
|
-
{
|
|
1254
|
-
"type": "BLANK"
|
|
1255
|
-
}
|
|
1256
|
-
]
|
|
1257
|
-
}
|
|
1258
|
-
]
|
|
1232
|
+
"type": "SYMBOL",
|
|
1233
|
+
"name": "else_clause"
|
|
1259
1234
|
},
|
|
1260
1235
|
{
|
|
1261
|
-
"type": "
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
}
|
|
1269
|
-
},
|
|
1270
|
-
{
|
|
1271
|
-
"type": "CHOICE",
|
|
1272
|
-
"members": [
|
|
1273
|
-
{
|
|
1274
|
-
"type": "SYMBOL",
|
|
1275
|
-
"name": "else_clause"
|
|
1276
|
-
},
|
|
1277
|
-
{
|
|
1278
|
-
"type": "BLANK"
|
|
1279
|
-
}
|
|
1280
|
-
]
|
|
1281
|
-
},
|
|
1282
|
-
{
|
|
1283
|
-
"type": "CHOICE",
|
|
1284
|
-
"members": [
|
|
1285
|
-
{
|
|
1286
|
-
"type": "SYMBOL",
|
|
1287
|
-
"name": "finally_clause"
|
|
1288
|
-
},
|
|
1289
|
-
{
|
|
1290
|
-
"type": "BLANK"
|
|
1291
|
-
}
|
|
1292
|
-
]
|
|
1293
|
-
}
|
|
1294
|
-
]
|
|
1295
|
-
},
|
|
1236
|
+
"type": "BLANK"
|
|
1237
|
+
}
|
|
1238
|
+
]
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
"type": "CHOICE",
|
|
1242
|
+
"members": [
|
|
1296
1243
|
{
|
|
1297
1244
|
"type": "SYMBOL",
|
|
1298
1245
|
"name": "finally_clause"
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
"type": "BLANK"
|
|
1299
1249
|
}
|
|
1300
1250
|
]
|
|
1301
1251
|
}
|
|
@@ -1312,101 +1262,102 @@
|
|
|
1312
1262
|
"type": "CHOICE",
|
|
1313
1263
|
"members": [
|
|
1314
1264
|
{
|
|
1315
|
-
"type": "
|
|
1265
|
+
"type": "TOKEN",
|
|
1266
|
+
"content": {
|
|
1267
|
+
"type": "PREC",
|
|
1268
|
+
"value": 1,
|
|
1269
|
+
"content": {
|
|
1270
|
+
"type": "STRING",
|
|
1271
|
+
"value": "*"
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
"type": "BLANK"
|
|
1277
|
+
}
|
|
1278
|
+
]
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
"type": "CHOICE",
|
|
1282
|
+
"members": [
|
|
1283
|
+
{
|
|
1284
|
+
"type": "CHOICE",
|
|
1316
1285
|
"members": [
|
|
1317
1286
|
{
|
|
1318
|
-
"type": "
|
|
1319
|
-
"name": "value",
|
|
1320
|
-
"content": {
|
|
1321
|
-
"type": "SYMBOL",
|
|
1322
|
-
"name": "expression"
|
|
1323
|
-
}
|
|
1324
|
-
},
|
|
1325
|
-
{
|
|
1326
|
-
"type": "CHOICE",
|
|
1287
|
+
"type": "SEQ",
|
|
1327
1288
|
"members": [
|
|
1328
1289
|
{
|
|
1329
|
-
"type": "
|
|
1290
|
+
"type": "FIELD",
|
|
1291
|
+
"name": "value",
|
|
1292
|
+
"content": {
|
|
1293
|
+
"type": "SYMBOL",
|
|
1294
|
+
"name": "expression"
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
"type": "CHOICE",
|
|
1330
1299
|
"members": [
|
|
1331
1300
|
{
|
|
1332
|
-
"type": "
|
|
1301
|
+
"type": "SEQ",
|
|
1333
1302
|
"members": [
|
|
1334
1303
|
{
|
|
1335
1304
|
"type": "STRING",
|
|
1336
1305
|
"value": "as"
|
|
1337
1306
|
},
|
|
1338
1307
|
{
|
|
1339
|
-
"type": "
|
|
1340
|
-
"
|
|
1308
|
+
"type": "FIELD",
|
|
1309
|
+
"name": "alias",
|
|
1310
|
+
"content": {
|
|
1311
|
+
"type": "SYMBOL",
|
|
1312
|
+
"name": "expression"
|
|
1313
|
+
}
|
|
1341
1314
|
}
|
|
1342
1315
|
]
|
|
1343
1316
|
},
|
|
1344
1317
|
{
|
|
1345
|
-
"type": "
|
|
1346
|
-
"name": "alias",
|
|
1347
|
-
"content": {
|
|
1348
|
-
"type": "SYMBOL",
|
|
1349
|
-
"name": "expression"
|
|
1350
|
-
}
|
|
1318
|
+
"type": "BLANK"
|
|
1351
1319
|
}
|
|
1352
1320
|
]
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
"type": "BLANK"
|
|
1356
1321
|
}
|
|
1357
1322
|
]
|
|
1358
|
-
}
|
|
1359
|
-
]
|
|
1360
|
-
},
|
|
1361
|
-
{
|
|
1362
|
-
"type": "BLANK"
|
|
1363
|
-
}
|
|
1364
|
-
]
|
|
1365
|
-
},
|
|
1366
|
-
{
|
|
1367
|
-
"type": "STRING",
|
|
1368
|
-
"value": ":"
|
|
1369
|
-
},
|
|
1370
|
-
{
|
|
1371
|
-
"type": "SYMBOL",
|
|
1372
|
-
"name": "_suite"
|
|
1373
|
-
}
|
|
1374
|
-
]
|
|
1375
|
-
},
|
|
1376
|
-
"except_group_clause": {
|
|
1377
|
-
"type": "SEQ",
|
|
1378
|
-
"members": [
|
|
1379
|
-
{
|
|
1380
|
-
"type": "STRING",
|
|
1381
|
-
"value": "except*"
|
|
1382
|
-
},
|
|
1383
|
-
{
|
|
1384
|
-
"type": "SEQ",
|
|
1385
|
-
"members": [
|
|
1386
|
-
{
|
|
1387
|
-
"type": "SYMBOL",
|
|
1388
|
-
"name": "expression"
|
|
1389
|
-
},
|
|
1390
|
-
{
|
|
1391
|
-
"type": "CHOICE",
|
|
1392
|
-
"members": [
|
|
1323
|
+
},
|
|
1393
1324
|
{
|
|
1394
1325
|
"type": "SEQ",
|
|
1395
1326
|
"members": [
|
|
1396
1327
|
{
|
|
1397
|
-
"type": "
|
|
1398
|
-
"
|
|
1328
|
+
"type": "FIELD",
|
|
1329
|
+
"name": "value",
|
|
1330
|
+
"content": {
|
|
1331
|
+
"type": "SYMBOL",
|
|
1332
|
+
"name": "expression"
|
|
1333
|
+
}
|
|
1399
1334
|
},
|
|
1400
1335
|
{
|
|
1401
|
-
"type": "
|
|
1402
|
-
"
|
|
1336
|
+
"type": "REPEAT",
|
|
1337
|
+
"content": {
|
|
1338
|
+
"type": "SEQ",
|
|
1339
|
+
"members": [
|
|
1340
|
+
{
|
|
1341
|
+
"type": "STRING",
|
|
1342
|
+
"value": ","
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
"type": "FIELD",
|
|
1346
|
+
"name": "value",
|
|
1347
|
+
"content": {
|
|
1348
|
+
"type": "SYMBOL",
|
|
1349
|
+
"name": "expression"
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
]
|
|
1353
|
+
}
|
|
1403
1354
|
}
|
|
1404
1355
|
]
|
|
1405
|
-
},
|
|
1406
|
-
{
|
|
1407
|
-
"type": "BLANK"
|
|
1408
1356
|
}
|
|
1409
1357
|
]
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
"type": "BLANK"
|
|
1410
1361
|
}
|
|
1411
1362
|
]
|
|
1412
1363
|
},
|
|
@@ -6336,5 +6287,149 @@
|
|
|
6336
6287
|
"primary_expression",
|
|
6337
6288
|
"pattern",
|
|
6338
6289
|
"parameter"
|
|
6339
|
-
]
|
|
6340
|
-
|
|
6290
|
+
],
|
|
6291
|
+
"reserved": {
|
|
6292
|
+
"global": [
|
|
6293
|
+
{
|
|
6294
|
+
"type": "STRING",
|
|
6295
|
+
"value": "False"
|
|
6296
|
+
},
|
|
6297
|
+
{
|
|
6298
|
+
"type": "STRING",
|
|
6299
|
+
"value": "await"
|
|
6300
|
+
},
|
|
6301
|
+
{
|
|
6302
|
+
"type": "STRING",
|
|
6303
|
+
"value": "else"
|
|
6304
|
+
},
|
|
6305
|
+
{
|
|
6306
|
+
"type": "STRING",
|
|
6307
|
+
"value": "import"
|
|
6308
|
+
},
|
|
6309
|
+
{
|
|
6310
|
+
"type": "STRING",
|
|
6311
|
+
"value": "pass"
|
|
6312
|
+
},
|
|
6313
|
+
{
|
|
6314
|
+
"type": "STRING",
|
|
6315
|
+
"value": "None"
|
|
6316
|
+
},
|
|
6317
|
+
{
|
|
6318
|
+
"type": "STRING",
|
|
6319
|
+
"value": "break"
|
|
6320
|
+
},
|
|
6321
|
+
{
|
|
6322
|
+
"type": "STRING",
|
|
6323
|
+
"value": "except"
|
|
6324
|
+
},
|
|
6325
|
+
{
|
|
6326
|
+
"type": "STRING",
|
|
6327
|
+
"value": "in"
|
|
6328
|
+
},
|
|
6329
|
+
{
|
|
6330
|
+
"type": "STRING",
|
|
6331
|
+
"value": "raise"
|
|
6332
|
+
},
|
|
6333
|
+
{
|
|
6334
|
+
"type": "STRING",
|
|
6335
|
+
"value": "True"
|
|
6336
|
+
},
|
|
6337
|
+
{
|
|
6338
|
+
"type": "STRING",
|
|
6339
|
+
"value": "class"
|
|
6340
|
+
},
|
|
6341
|
+
{
|
|
6342
|
+
"type": "STRING",
|
|
6343
|
+
"value": "finally"
|
|
6344
|
+
},
|
|
6345
|
+
{
|
|
6346
|
+
"type": "STRING",
|
|
6347
|
+
"value": "is"
|
|
6348
|
+
},
|
|
6349
|
+
{
|
|
6350
|
+
"type": "STRING",
|
|
6351
|
+
"value": "return"
|
|
6352
|
+
},
|
|
6353
|
+
{
|
|
6354
|
+
"type": "STRING",
|
|
6355
|
+
"value": "and"
|
|
6356
|
+
},
|
|
6357
|
+
{
|
|
6358
|
+
"type": "STRING",
|
|
6359
|
+
"value": "continue"
|
|
6360
|
+
},
|
|
6361
|
+
{
|
|
6362
|
+
"type": "STRING",
|
|
6363
|
+
"value": "for"
|
|
6364
|
+
},
|
|
6365
|
+
{
|
|
6366
|
+
"type": "STRING",
|
|
6367
|
+
"value": "lambda"
|
|
6368
|
+
},
|
|
6369
|
+
{
|
|
6370
|
+
"type": "STRING",
|
|
6371
|
+
"value": "try"
|
|
6372
|
+
},
|
|
6373
|
+
{
|
|
6374
|
+
"type": "STRING",
|
|
6375
|
+
"value": "as"
|
|
6376
|
+
},
|
|
6377
|
+
{
|
|
6378
|
+
"type": "STRING",
|
|
6379
|
+
"value": "def"
|
|
6380
|
+
},
|
|
6381
|
+
{
|
|
6382
|
+
"type": "STRING",
|
|
6383
|
+
"value": "from"
|
|
6384
|
+
},
|
|
6385
|
+
{
|
|
6386
|
+
"type": "STRING",
|
|
6387
|
+
"value": "nonlocal"
|
|
6388
|
+
},
|
|
6389
|
+
{
|
|
6390
|
+
"type": "STRING",
|
|
6391
|
+
"value": "while"
|
|
6392
|
+
},
|
|
6393
|
+
{
|
|
6394
|
+
"type": "STRING",
|
|
6395
|
+
"value": "assert"
|
|
6396
|
+
},
|
|
6397
|
+
{
|
|
6398
|
+
"type": "STRING",
|
|
6399
|
+
"value": "del"
|
|
6400
|
+
},
|
|
6401
|
+
{
|
|
6402
|
+
"type": "STRING",
|
|
6403
|
+
"value": "global"
|
|
6404
|
+
},
|
|
6405
|
+
{
|
|
6406
|
+
"type": "STRING",
|
|
6407
|
+
"value": "not"
|
|
6408
|
+
},
|
|
6409
|
+
{
|
|
6410
|
+
"type": "STRING",
|
|
6411
|
+
"value": "with"
|
|
6412
|
+
},
|
|
6413
|
+
{
|
|
6414
|
+
"type": "STRING",
|
|
6415
|
+
"value": "async"
|
|
6416
|
+
},
|
|
6417
|
+
{
|
|
6418
|
+
"type": "STRING",
|
|
6419
|
+
"value": "elif"
|
|
6420
|
+
},
|
|
6421
|
+
{
|
|
6422
|
+
"type": "STRING",
|
|
6423
|
+
"value": "if"
|
|
6424
|
+
},
|
|
6425
|
+
{
|
|
6426
|
+
"type": "STRING",
|
|
6427
|
+
"value": "or"
|
|
6428
|
+
},
|
|
6429
|
+
{
|
|
6430
|
+
"type": "STRING",
|
|
6431
|
+
"value": "yield"
|
|
6432
|
+
}
|
|
6433
|
+
]
|
|
6434
|
+
}
|
|
6435
|
+
}
|
package/src/node-types.json
CHANGED
|
@@ -1514,7 +1514,7 @@
|
|
|
1514
1514
|
]
|
|
1515
1515
|
},
|
|
1516
1516
|
"value": {
|
|
1517
|
-
"multiple":
|
|
1517
|
+
"multiple": true,
|
|
1518
1518
|
"required": false,
|
|
1519
1519
|
"types": [
|
|
1520
1520
|
{
|
|
@@ -1535,25 +1535,6 @@
|
|
|
1535
1535
|
]
|
|
1536
1536
|
}
|
|
1537
1537
|
},
|
|
1538
|
-
{
|
|
1539
|
-
"type": "except_group_clause",
|
|
1540
|
-
"named": true,
|
|
1541
|
-
"fields": {},
|
|
1542
|
-
"children": {
|
|
1543
|
-
"multiple": true,
|
|
1544
|
-
"required": true,
|
|
1545
|
-
"types": [
|
|
1546
|
-
{
|
|
1547
|
-
"type": "block",
|
|
1548
|
-
"named": true
|
|
1549
|
-
},
|
|
1550
|
-
{
|
|
1551
|
-
"type": "expression",
|
|
1552
|
-
"named": true
|
|
1553
|
-
}
|
|
1554
|
-
]
|
|
1555
|
-
}
|
|
1556
|
-
},
|
|
1557
1538
|
{
|
|
1558
1539
|
"type": "exec_statement",
|
|
1559
1540
|
"named": true,
|
|
@@ -2910,7 +2891,7 @@
|
|
|
2910
2891
|
},
|
|
2911
2892
|
"children": {
|
|
2912
2893
|
"multiple": true,
|
|
2913
|
-
"required":
|
|
2894
|
+
"required": false,
|
|
2914
2895
|
"types": [
|
|
2915
2896
|
{
|
|
2916
2897
|
"type": "else_clause",
|
|
@@ -2920,10 +2901,6 @@
|
|
|
2920
2901
|
"type": "except_clause",
|
|
2921
2902
|
"named": true
|
|
2922
2903
|
},
|
|
2923
|
-
{
|
|
2924
|
-
"type": "except_group_clause",
|
|
2925
|
-
"named": true
|
|
2926
|
-
},
|
|
2927
2904
|
{
|
|
2928
2905
|
"type": "finally_clause",
|
|
2929
2906
|
"named": true
|
|
@@ -3574,7 +3551,8 @@
|
|
|
3574
3551
|
},
|
|
3575
3552
|
{
|
|
3576
3553
|
"type": "comment",
|
|
3577
|
-
"named": true
|
|
3554
|
+
"named": true,
|
|
3555
|
+
"extra": true
|
|
3578
3556
|
},
|
|
3579
3557
|
{
|
|
3580
3558
|
"type": "continue",
|
|
@@ -3612,10 +3590,6 @@
|
|
|
3612
3590
|
"type": "except",
|
|
3613
3591
|
"named": false
|
|
3614
3592
|
},
|
|
3615
|
-
{
|
|
3616
|
-
"type": "except*",
|
|
3617
|
-
"named": false
|
|
3618
|
-
},
|
|
3619
3593
|
{
|
|
3620
3594
|
"type": "exec",
|
|
3621
3595
|
"named": false
|
|
@@ -3674,7 +3648,8 @@
|
|
|
3674
3648
|
},
|
|
3675
3649
|
{
|
|
3676
3650
|
"type": "line_continuation",
|
|
3677
|
-
"named": true
|
|
3651
|
+
"named": true,
|
|
3652
|
+
"extra": true
|
|
3678
3653
|
},
|
|
3679
3654
|
{
|
|
3680
3655
|
"type": "match",
|