tree-sitter-bsl 0.1.3 → 0.1.4
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 +17 -7
- package/package.json +1 -1
- 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 +191 -4
- package/src/parser.c +10864 -14333
- package/tree-sitter-bsl.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -12,7 +12,7 @@ const PREC = {
|
|
|
12
12
|
NEW: 19,
|
|
13
13
|
TERNARY: 20,
|
|
14
14
|
ASSIGNMENT: 21,
|
|
15
|
-
AWAIT: 22
|
|
15
|
+
AWAIT: 22,
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const keyword = (...words) => token(choice(...words.map(caseInsensitive)));
|
|
@@ -99,6 +99,10 @@ function buildKeywords() {
|
|
|
99
99
|
return kw;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
function reservedKeywords($) {
|
|
103
|
+
return Object.keys(buildKeywords()).map((k) => $[k]);
|
|
104
|
+
}
|
|
105
|
+
|
|
102
106
|
const Preprocessor = {
|
|
103
107
|
preprocessor: ($) => {
|
|
104
108
|
const region = [
|
|
@@ -180,6 +184,9 @@ module.exports = grammar({
|
|
|
180
184
|
|
|
181
185
|
word: ($) => $.identifier,
|
|
182
186
|
|
|
187
|
+
reserved: {
|
|
188
|
+
global: ($) => reservedKeywords($),
|
|
189
|
+
},
|
|
183
190
|
rules: {
|
|
184
191
|
source_file: ($) => repeat($._definition),
|
|
185
192
|
|
|
@@ -258,7 +265,8 @@ module.exports = grammar({
|
|
|
258
265
|
$.await_statement
|
|
259
266
|
),
|
|
260
267
|
|
|
261
|
-
call_statement: ($) =>
|
|
268
|
+
call_statement: ($) =>
|
|
269
|
+
seq(choice($.method_call, $.call_expression), optional(";")),
|
|
262
270
|
|
|
263
271
|
assignment_statement: ($) =>
|
|
264
272
|
seq(
|
|
@@ -444,7 +452,8 @@ module.exports = grammar({
|
|
|
444
452
|
|
|
445
453
|
call_expression: ($) => prec(PREC.CALL - 1, $._access_call),
|
|
446
454
|
|
|
447
|
-
await_expression: ($) =>
|
|
455
|
+
await_expression: ($) =>
|
|
456
|
+
prec(PREC.AWAIT, seq($.AWAIT_KEYWORD, $.expression)),
|
|
448
457
|
|
|
449
458
|
_assignment_member: ($) => choice($.identifier, $.property_access),
|
|
450
459
|
|
|
@@ -463,13 +472,15 @@ module.exports = grammar({
|
|
|
463
472
|
)
|
|
464
473
|
),
|
|
465
474
|
_access_call: ($) => seq($.access, ".", $.method_call),
|
|
466
|
-
_access_index: ($) =>
|
|
467
|
-
seq($.access, "[", alias($.expression, $.index), "]"),
|
|
475
|
+
_access_index: ($) => seq($.access, "[", alias($.expression, $.index), "]"),
|
|
468
476
|
_access_property: ($) =>
|
|
469
477
|
seq($.access, ".", alias($.identifier, $.property)),
|
|
470
478
|
|
|
471
479
|
method_call: ($) =>
|
|
472
|
-
prec(
|
|
480
|
+
prec(
|
|
481
|
+
PREC.CALL,
|
|
482
|
+
seq(field("name", $.identifier), field("arguments", $.arguments))
|
|
483
|
+
),
|
|
473
484
|
|
|
474
485
|
arguments: ($) => seq("(", sepBy(",", $.expression), ")"),
|
|
475
486
|
|
|
@@ -486,7 +497,6 @@ module.exports = grammar({
|
|
|
486
497
|
$.boolean,
|
|
487
498
|
$.UNDEFINED_KEYWORD,
|
|
488
499
|
$.NULL_KEYWORD
|
|
489
|
-
//TODO Date
|
|
490
500
|
),
|
|
491
501
|
|
|
492
502
|
boolean: ($) => choice($.TRUE_KEYWORD, $.FALSE_KEYWORD),
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/grammar.json
CHANGED
|
@@ -1561,7 +1561,7 @@
|
|
|
1561
1561
|
},
|
|
1562
1562
|
"call_expression": {
|
|
1563
1563
|
"type": "PREC",
|
|
1564
|
-
"value":
|
|
1564
|
+
"value": 17,
|
|
1565
1565
|
"content": {
|
|
1566
1566
|
"type": "SYMBOL",
|
|
1567
1567
|
"name": "_access_call"
|
|
@@ -1599,7 +1599,7 @@
|
|
|
1599
1599
|
},
|
|
1600
1600
|
"property_access": {
|
|
1601
1601
|
"type": "PREC",
|
|
1602
|
-
"value":
|
|
1602
|
+
"value": 17,
|
|
1603
1603
|
"content": {
|
|
1604
1604
|
"type": "CHOICE",
|
|
1605
1605
|
"members": [
|
|
@@ -1710,7 +1710,7 @@
|
|
|
1710
1710
|
},
|
|
1711
1711
|
"method_call": {
|
|
1712
1712
|
"type": "PREC",
|
|
1713
|
-
"value":
|
|
1713
|
+
"value": 18,
|
|
1714
1714
|
"content": {
|
|
1715
1715
|
"type": "SEQ",
|
|
1716
1716
|
"members": [
|
|
@@ -3320,5 +3320,192 @@
|
|
|
3320
3320
|
"supertypes": [
|
|
3321
3321
|
"statement"
|
|
3322
3322
|
],
|
|
3323
|
-
"reserved": {
|
|
3323
|
+
"reserved": {
|
|
3324
|
+
"global": [
|
|
3325
|
+
{
|
|
3326
|
+
"type": "SYMBOL",
|
|
3327
|
+
"name": "IF_KEYWORD"
|
|
3328
|
+
},
|
|
3329
|
+
{
|
|
3330
|
+
"type": "SYMBOL",
|
|
3331
|
+
"name": "THEN_KEYWORD"
|
|
3332
|
+
},
|
|
3333
|
+
{
|
|
3334
|
+
"type": "SYMBOL",
|
|
3335
|
+
"name": "ELSIF_KEYWORD"
|
|
3336
|
+
},
|
|
3337
|
+
{
|
|
3338
|
+
"type": "SYMBOL",
|
|
3339
|
+
"name": "ELSE_KEYWORD"
|
|
3340
|
+
},
|
|
3341
|
+
{
|
|
3342
|
+
"type": "SYMBOL",
|
|
3343
|
+
"name": "ENDIF_KEYWORD"
|
|
3344
|
+
},
|
|
3345
|
+
{
|
|
3346
|
+
"type": "SYMBOL",
|
|
3347
|
+
"name": "FOR_KEYWORD"
|
|
3348
|
+
},
|
|
3349
|
+
{
|
|
3350
|
+
"type": "SYMBOL",
|
|
3351
|
+
"name": "EACH_KEYWORD"
|
|
3352
|
+
},
|
|
3353
|
+
{
|
|
3354
|
+
"type": "SYMBOL",
|
|
3355
|
+
"name": "IN_KEYWORD"
|
|
3356
|
+
},
|
|
3357
|
+
{
|
|
3358
|
+
"type": "SYMBOL",
|
|
3359
|
+
"name": "TO_KEYWORD"
|
|
3360
|
+
},
|
|
3361
|
+
{
|
|
3362
|
+
"type": "SYMBOL",
|
|
3363
|
+
"name": "WHILE_KEYWORD"
|
|
3364
|
+
},
|
|
3365
|
+
{
|
|
3366
|
+
"type": "SYMBOL",
|
|
3367
|
+
"name": "DO_KEYWORD"
|
|
3368
|
+
},
|
|
3369
|
+
{
|
|
3370
|
+
"type": "SYMBOL",
|
|
3371
|
+
"name": "ENDDO_KEYWORD"
|
|
3372
|
+
},
|
|
3373
|
+
{
|
|
3374
|
+
"type": "SYMBOL",
|
|
3375
|
+
"name": "GOTO_KEYWORD"
|
|
3376
|
+
},
|
|
3377
|
+
{
|
|
3378
|
+
"type": "SYMBOL",
|
|
3379
|
+
"name": "RETURN_KEYWORD"
|
|
3380
|
+
},
|
|
3381
|
+
{
|
|
3382
|
+
"type": "SYMBOL",
|
|
3383
|
+
"name": "BREAK_KEYWORD"
|
|
3384
|
+
},
|
|
3385
|
+
{
|
|
3386
|
+
"type": "SYMBOL",
|
|
3387
|
+
"name": "CONTINUE_KEYWORD"
|
|
3388
|
+
},
|
|
3389
|
+
{
|
|
3390
|
+
"type": "SYMBOL",
|
|
3391
|
+
"name": "PROCEDURE_KEYWORD"
|
|
3392
|
+
},
|
|
3393
|
+
{
|
|
3394
|
+
"type": "SYMBOL",
|
|
3395
|
+
"name": "FUNCTION_KEYWORD"
|
|
3396
|
+
},
|
|
3397
|
+
{
|
|
3398
|
+
"type": "SYMBOL",
|
|
3399
|
+
"name": "ENDPROCEDURE_KEYWORD"
|
|
3400
|
+
},
|
|
3401
|
+
{
|
|
3402
|
+
"type": "SYMBOL",
|
|
3403
|
+
"name": "ENDFUNCTION_KEYWORD"
|
|
3404
|
+
},
|
|
3405
|
+
{
|
|
3406
|
+
"type": "SYMBOL",
|
|
3407
|
+
"name": "VAR_KEYWORD"
|
|
3408
|
+
},
|
|
3409
|
+
{
|
|
3410
|
+
"type": "SYMBOL",
|
|
3411
|
+
"name": "EXPORT_KEYWORD"
|
|
3412
|
+
},
|
|
3413
|
+
{
|
|
3414
|
+
"type": "SYMBOL",
|
|
3415
|
+
"name": "VAL_KEYWORD"
|
|
3416
|
+
},
|
|
3417
|
+
{
|
|
3418
|
+
"type": "SYMBOL",
|
|
3419
|
+
"name": "TRUE_KEYWORD"
|
|
3420
|
+
},
|
|
3421
|
+
{
|
|
3422
|
+
"type": "SYMBOL",
|
|
3423
|
+
"name": "FALSE_KEYWORD"
|
|
3424
|
+
},
|
|
3425
|
+
{
|
|
3426
|
+
"type": "SYMBOL",
|
|
3427
|
+
"name": "UNDEFINED_KEYWORD"
|
|
3428
|
+
},
|
|
3429
|
+
{
|
|
3430
|
+
"type": "SYMBOL",
|
|
3431
|
+
"name": "TRY_KEYWORD"
|
|
3432
|
+
},
|
|
3433
|
+
{
|
|
3434
|
+
"type": "SYMBOL",
|
|
3435
|
+
"name": "EXCEPT_KEYWORD"
|
|
3436
|
+
},
|
|
3437
|
+
{
|
|
3438
|
+
"type": "SYMBOL",
|
|
3439
|
+
"name": "RAISE_KEYWORD"
|
|
3440
|
+
},
|
|
3441
|
+
{
|
|
3442
|
+
"type": "SYMBOL",
|
|
3443
|
+
"name": "ENDTRY_KEYWORD"
|
|
3444
|
+
},
|
|
3445
|
+
{
|
|
3446
|
+
"type": "SYMBOL",
|
|
3447
|
+
"name": "ASYNC_KEYWORD"
|
|
3448
|
+
},
|
|
3449
|
+
{
|
|
3450
|
+
"type": "SYMBOL",
|
|
3451
|
+
"name": "AWAIT_KEYWORD"
|
|
3452
|
+
},
|
|
3453
|
+
{
|
|
3454
|
+
"type": "SYMBOL",
|
|
3455
|
+
"name": "NEW_KEYWORD"
|
|
3456
|
+
},
|
|
3457
|
+
{
|
|
3458
|
+
"type": "SYMBOL",
|
|
3459
|
+
"name": "EXECUTE_KEYWORD"
|
|
3460
|
+
},
|
|
3461
|
+
{
|
|
3462
|
+
"type": "SYMBOL",
|
|
3463
|
+
"name": "ADDHANDLER_KEYWORD"
|
|
3464
|
+
},
|
|
3465
|
+
{
|
|
3466
|
+
"type": "SYMBOL",
|
|
3467
|
+
"name": "REMOVEHANDLER_KEYWORD"
|
|
3468
|
+
},
|
|
3469
|
+
{
|
|
3470
|
+
"type": "SYMBOL",
|
|
3471
|
+
"name": "AND_KEYWORD"
|
|
3472
|
+
},
|
|
3473
|
+
{
|
|
3474
|
+
"type": "SYMBOL",
|
|
3475
|
+
"name": "OR_KEYWORD"
|
|
3476
|
+
},
|
|
3477
|
+
{
|
|
3478
|
+
"type": "SYMBOL",
|
|
3479
|
+
"name": "NOT_KEYWORD"
|
|
3480
|
+
},
|
|
3481
|
+
{
|
|
3482
|
+
"type": "SYMBOL",
|
|
3483
|
+
"name": "PREPROC_IF_KEYWORD"
|
|
3484
|
+
},
|
|
3485
|
+
{
|
|
3486
|
+
"type": "SYMBOL",
|
|
3487
|
+
"name": "PREPROC_ELSIF_KEYWORD"
|
|
3488
|
+
},
|
|
3489
|
+
{
|
|
3490
|
+
"type": "SYMBOL",
|
|
3491
|
+
"name": "PREPROC_ELSE_KEYWORD"
|
|
3492
|
+
},
|
|
3493
|
+
{
|
|
3494
|
+
"type": "SYMBOL",
|
|
3495
|
+
"name": "PREPROC_ENDIF_KEYWORD"
|
|
3496
|
+
},
|
|
3497
|
+
{
|
|
3498
|
+
"type": "SYMBOL",
|
|
3499
|
+
"name": "PREPROC_REGION_KEYWORD"
|
|
3500
|
+
},
|
|
3501
|
+
{
|
|
3502
|
+
"type": "SYMBOL",
|
|
3503
|
+
"name": "PREPROC_ENDREGION_KEYWORD"
|
|
3504
|
+
},
|
|
3505
|
+
{
|
|
3506
|
+
"type": "SYMBOL",
|
|
3507
|
+
"name": "NULL_KEYWORD"
|
|
3508
|
+
}
|
|
3509
|
+
]
|
|
3510
|
+
}
|
|
3324
3511
|
}
|