tree-sitter-bsl 0.1.5 → 0.1.6
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/grammar.js +12 -13
- package/package.json +5 -4
- package/prebuilds/darwin-arm64/tree-sitter-bsl.node +0 -0
- package/prebuilds/darwin-x64/tree-sitter-bsl.node +0 -0
- package/prebuilds/linux-arm64/tree-sitter-bsl.node +0 -0
- package/prebuilds/linux-x64/tree-sitter-bsl.node +0 -0
- package/prebuilds/win32-arm64/tree-sitter-bsl.node +0 -0
- package/prebuilds/win32-x64/tree-sitter-bsl.node +0 -0
- package/src/grammar.json +112 -76
- package/src/node-types.json +60 -12
- package/src/parser.c +8939 -8176
- package/src/tree_sitter/array.h +110 -71
- package/src/tree_sitter/parser.h +0 -1
- package/tree-sitter-bsl.wasm +0 -0
- package/tree-sitter.json +3 -3
package/grammar.js
CHANGED
|
@@ -243,11 +243,9 @@ module.exports = grammar({
|
|
|
243
243
|
seq(
|
|
244
244
|
field('val', optional($.VAL_KEYWORD)),
|
|
245
245
|
field('name', $.identifier),
|
|
246
|
-
field('def',
|
|
246
|
+
optional(seq('=', field('def', $._const_value))),
|
|
247
247
|
),
|
|
248
248
|
|
|
249
|
-
_def_value: ($) => seq('=', $._const_value),
|
|
250
|
-
|
|
251
249
|
// Statements
|
|
252
250
|
_statement: ($) =>
|
|
253
251
|
choice(
|
|
@@ -284,7 +282,7 @@ module.exports = grammar({
|
|
|
284
282
|
),
|
|
285
283
|
|
|
286
284
|
return_statement: ($) =>
|
|
287
|
-
prec.right(seq($.RETURN_KEYWORD, optional($.expression), optional(';'))),
|
|
285
|
+
prec.right(seq($.RETURN_KEYWORD, field('result', optional($.expression)), optional(';'))),
|
|
288
286
|
|
|
289
287
|
try_statement: ($) =>
|
|
290
288
|
seq(
|
|
@@ -395,6 +393,7 @@ module.exports = grammar({
|
|
|
395
393
|
$.binary_expression,
|
|
396
394
|
$.ternary_expression,
|
|
397
395
|
$.new_expression,
|
|
396
|
+
$.new_expression_method,
|
|
398
397
|
$.method_call,
|
|
399
398
|
$.call_expression,
|
|
400
399
|
$.property_access,
|
|
@@ -449,15 +448,15 @@ module.exports = grammar({
|
|
|
449
448
|
new_expression: ($) =>
|
|
450
449
|
prec(
|
|
451
450
|
PREC.NEW,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
451
|
+
seq(
|
|
452
|
+
$.NEW_KEYWORD,
|
|
453
|
+
field('type', $.identifier),
|
|
454
|
+
field('arguments', optional($.arguments)),
|
|
455
|
+
)),
|
|
456
|
+
new_expression_method: ($) =>
|
|
457
|
+
prec.right(
|
|
458
|
+
PREC.NEW,
|
|
459
|
+
seq($.NEW_KEYWORD, '(', field('type', $.expression), optional(seq(',', field('arguments', $.expression), ')')))),
|
|
461
460
|
|
|
462
461
|
call_expression: ($) => prec(PREC.CALL - 1, $._access_call),
|
|
463
462
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-sitter-bsl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "1C (BSL) grammar for tree-sitter",
|
|
5
5
|
"repository": "https://github.com/alkoleft/tree-sitter-bsl",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"eslint": "^9.14.0",
|
|
34
34
|
"eslint-config-treesitter": "^1.0.2",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"prebuildify": "^6.0.1",
|
|
36
|
+
"tree-sitter": "^0.25.0",
|
|
37
|
+
"tree-sitter-cli": "^0.26.6"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
|
-
"tree-sitter": "^0.
|
|
40
|
+
"tree-sitter": "^0.25.0"
|
|
40
41
|
},
|
|
41
42
|
"peerDependenciesMeta": {
|
|
42
43
|
"tree-sitter": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/grammar.json
CHANGED
|
@@ -315,33 +315,29 @@
|
|
|
315
315
|
}
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
|
-
"type": "
|
|
319
|
-
"
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
"type": "SYMBOL",
|
|
344
|
-
"name": "_const_value"
|
|
318
|
+
"type": "CHOICE",
|
|
319
|
+
"members": [
|
|
320
|
+
{
|
|
321
|
+
"type": "SEQ",
|
|
322
|
+
"members": [
|
|
323
|
+
{
|
|
324
|
+
"type": "STRING",
|
|
325
|
+
"value": "="
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"type": "FIELD",
|
|
329
|
+
"name": "def",
|
|
330
|
+
"content": {
|
|
331
|
+
"type": "SYMBOL",
|
|
332
|
+
"name": "_const_value"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"type": "BLANK"
|
|
339
|
+
}
|
|
340
|
+
]
|
|
345
341
|
}
|
|
346
342
|
]
|
|
347
343
|
},
|
|
@@ -504,16 +500,20 @@
|
|
|
504
500
|
"name": "RETURN_KEYWORD"
|
|
505
501
|
},
|
|
506
502
|
{
|
|
507
|
-
"type": "
|
|
508
|
-
"
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
503
|
+
"type": "FIELD",
|
|
504
|
+
"name": "result",
|
|
505
|
+
"content": {
|
|
506
|
+
"type": "CHOICE",
|
|
507
|
+
"members": [
|
|
508
|
+
{
|
|
509
|
+
"type": "SYMBOL",
|
|
510
|
+
"name": "expression"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"type": "BLANK"
|
|
514
|
+
}
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
517
|
},
|
|
518
518
|
{
|
|
519
519
|
"type": "CHOICE",
|
|
@@ -1206,6 +1206,10 @@
|
|
|
1206
1206
|
"type": "SYMBOL",
|
|
1207
1207
|
"name": "new_expression"
|
|
1208
1208
|
},
|
|
1209
|
+
{
|
|
1210
|
+
"type": "SYMBOL",
|
|
1211
|
+
"name": "new_expression_method"
|
|
1212
|
+
},
|
|
1209
1213
|
{
|
|
1210
1214
|
"type": "SYMBOL",
|
|
1211
1215
|
"name": "method_call"
|
|
@@ -1562,55 +1566,87 @@
|
|
|
1562
1566
|
"type": "PREC",
|
|
1563
1567
|
"value": 19,
|
|
1564
1568
|
"content": {
|
|
1565
|
-
"type": "
|
|
1569
|
+
"type": "SEQ",
|
|
1566
1570
|
"members": [
|
|
1567
1571
|
{
|
|
1568
|
-
"type": "
|
|
1569
|
-
"
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1572
|
+
"type": "SYMBOL",
|
|
1573
|
+
"name": "NEW_KEYWORD"
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
"type": "FIELD",
|
|
1577
|
+
"name": "type",
|
|
1578
|
+
"content": {
|
|
1579
|
+
"type": "SYMBOL",
|
|
1580
|
+
"name": "identifier"
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
"type": "FIELD",
|
|
1585
|
+
"name": "arguments",
|
|
1586
|
+
"content": {
|
|
1587
|
+
"type": "CHOICE",
|
|
1588
|
+
"members": [
|
|
1589
|
+
{
|
|
1578
1590
|
"type": "SYMBOL",
|
|
1579
|
-
"name": "
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
"type": "FIELD",
|
|
1584
|
-
"name": "arguments",
|
|
1585
|
-
"content": {
|
|
1586
|
-
"type": "CHOICE",
|
|
1587
|
-
"members": [
|
|
1588
|
-
{
|
|
1589
|
-
"type": "SYMBOL",
|
|
1590
|
-
"name": "arguments"
|
|
1591
|
-
},
|
|
1592
|
-
{
|
|
1593
|
-
"type": "BLANK"
|
|
1594
|
-
}
|
|
1595
|
-
]
|
|
1591
|
+
"name": "arguments"
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
"type": "BLANK"
|
|
1596
1595
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1596
|
+
]
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
]
|
|
1600
|
+
}
|
|
1601
|
+
},
|
|
1602
|
+
"new_expression_method": {
|
|
1603
|
+
"type": "PREC_RIGHT",
|
|
1604
|
+
"value": 19,
|
|
1605
|
+
"content": {
|
|
1606
|
+
"type": "SEQ",
|
|
1607
|
+
"members": [
|
|
1608
|
+
{
|
|
1609
|
+
"type": "SYMBOL",
|
|
1610
|
+
"name": "NEW_KEYWORD"
|
|
1599
1611
|
},
|
|
1600
1612
|
{
|
|
1601
|
-
"type": "
|
|
1613
|
+
"type": "STRING",
|
|
1614
|
+
"value": "("
|
|
1615
|
+
},
|
|
1616
|
+
{
|
|
1617
|
+
"type": "FIELD",
|
|
1618
|
+
"name": "type",
|
|
1619
|
+
"content": {
|
|
1620
|
+
"type": "SYMBOL",
|
|
1621
|
+
"name": "expression"
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
"type": "CHOICE",
|
|
1602
1626
|
"members": [
|
|
1603
1627
|
{
|
|
1604
|
-
"type": "
|
|
1605
|
-
"
|
|
1628
|
+
"type": "SEQ",
|
|
1629
|
+
"members": [
|
|
1630
|
+
{
|
|
1631
|
+
"type": "STRING",
|
|
1632
|
+
"value": ","
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
"type": "FIELD",
|
|
1636
|
+
"name": "arguments",
|
|
1637
|
+
"content": {
|
|
1638
|
+
"type": "SYMBOL",
|
|
1639
|
+
"name": "expression"
|
|
1640
|
+
}
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
"type": "STRING",
|
|
1644
|
+
"value": ")"
|
|
1645
|
+
}
|
|
1646
|
+
]
|
|
1606
1647
|
},
|
|
1607
1648
|
{
|
|
1608
|
-
"type": "
|
|
1609
|
-
"name": "arguments",
|
|
1610
|
-
"content": {
|
|
1611
|
-
"type": "SYMBOL",
|
|
1612
|
-
"name": "arguments"
|
|
1613
|
-
}
|
|
1649
|
+
"type": "BLANK"
|
|
1614
1650
|
}
|
|
1615
1651
|
]
|
|
1616
1652
|
}
|
package/src/node-types.json
CHANGED
|
@@ -527,6 +527,10 @@
|
|
|
527
527
|
"type": "new_expression",
|
|
528
528
|
"named": true
|
|
529
529
|
},
|
|
530
|
+
{
|
|
531
|
+
"type": "new_expression_method",
|
|
532
|
+
"named": true
|
|
533
|
+
},
|
|
530
534
|
{
|
|
531
535
|
"type": "property_access",
|
|
532
536
|
"named": true
|
|
@@ -1064,6 +1068,10 @@
|
|
|
1064
1068
|
"type": "new_expression",
|
|
1065
1069
|
"named": true
|
|
1066
1070
|
},
|
|
1071
|
+
{
|
|
1072
|
+
"type": "new_expression_method",
|
|
1073
|
+
"named": true
|
|
1074
|
+
},
|
|
1067
1075
|
{
|
|
1068
1076
|
"type": "property_access",
|
|
1069
1077
|
"named": true
|
|
@@ -1097,6 +1105,7 @@
|
|
|
1097
1105
|
{
|
|
1098
1106
|
"type": "line_comment",
|
|
1099
1107
|
"named": true,
|
|
1108
|
+
"extra": true,
|
|
1100
1109
|
"fields": {}
|
|
1101
1110
|
},
|
|
1102
1111
|
{
|
|
@@ -1141,7 +1150,7 @@
|
|
|
1141
1150
|
},
|
|
1142
1151
|
"type": {
|
|
1143
1152
|
"multiple": false,
|
|
1144
|
-
"required":
|
|
1153
|
+
"required": true,
|
|
1145
1154
|
"types": [
|
|
1146
1155
|
{
|
|
1147
1156
|
"type": "identifier",
|
|
@@ -1161,18 +1170,50 @@
|
|
|
1161
1170
|
]
|
|
1162
1171
|
}
|
|
1163
1172
|
},
|
|
1173
|
+
{
|
|
1174
|
+
"type": "new_expression_method",
|
|
1175
|
+
"named": true,
|
|
1176
|
+
"fields": {
|
|
1177
|
+
"arguments": {
|
|
1178
|
+
"multiple": false,
|
|
1179
|
+
"required": false,
|
|
1180
|
+
"types": [
|
|
1181
|
+
{
|
|
1182
|
+
"type": "expression",
|
|
1183
|
+
"named": true
|
|
1184
|
+
}
|
|
1185
|
+
]
|
|
1186
|
+
},
|
|
1187
|
+
"type": {
|
|
1188
|
+
"multiple": false,
|
|
1189
|
+
"required": true,
|
|
1190
|
+
"types": [
|
|
1191
|
+
{
|
|
1192
|
+
"type": "expression",
|
|
1193
|
+
"named": true
|
|
1194
|
+
}
|
|
1195
|
+
]
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
"children": {
|
|
1199
|
+
"multiple": false,
|
|
1200
|
+
"required": true,
|
|
1201
|
+
"types": [
|
|
1202
|
+
{
|
|
1203
|
+
"type": "NEW_KEYWORD",
|
|
1204
|
+
"named": true
|
|
1205
|
+
}
|
|
1206
|
+
]
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1164
1209
|
{
|
|
1165
1210
|
"type": "parameter",
|
|
1166
1211
|
"named": true,
|
|
1167
1212
|
"fields": {
|
|
1168
1213
|
"def": {
|
|
1169
|
-
"multiple":
|
|
1214
|
+
"multiple": false,
|
|
1170
1215
|
"required": false,
|
|
1171
1216
|
"types": [
|
|
1172
|
-
{
|
|
1173
|
-
"type": "=",
|
|
1174
|
-
"named": false
|
|
1175
|
-
},
|
|
1176
1217
|
{
|
|
1177
1218
|
"type": "NULL_KEYWORD",
|
|
1178
1219
|
"named": true
|
|
@@ -1471,18 +1512,25 @@
|
|
|
1471
1512
|
{
|
|
1472
1513
|
"type": "return_statement",
|
|
1473
1514
|
"named": true,
|
|
1474
|
-
"fields": {
|
|
1515
|
+
"fields": {
|
|
1516
|
+
"result": {
|
|
1517
|
+
"multiple": false,
|
|
1518
|
+
"required": false,
|
|
1519
|
+
"types": [
|
|
1520
|
+
{
|
|
1521
|
+
"type": "expression",
|
|
1522
|
+
"named": true
|
|
1523
|
+
}
|
|
1524
|
+
]
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1475
1527
|
"children": {
|
|
1476
|
-
"multiple":
|
|
1528
|
+
"multiple": false,
|
|
1477
1529
|
"required": true,
|
|
1478
1530
|
"types": [
|
|
1479
1531
|
{
|
|
1480
1532
|
"type": "RETURN_KEYWORD",
|
|
1481
1533
|
"named": true
|
|
1482
|
-
},
|
|
1483
|
-
{
|
|
1484
|
-
"type": "expression",
|
|
1485
|
-
"named": true
|
|
1486
1534
|
}
|
|
1487
1535
|
]
|
|
1488
1536
|
}
|