tree-sitter-abl 0.0.51 → 0.1.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/grammar.js +171 -19
- package/package.json +1 -1
- package/parser.exp +0 -0
- package/parser.lib +0 -0
- package/parser.obj +0 -0
- package/scanner.obj +0 -0
- package/src/grammar.json +1092 -98
- package/src/node-types.json +377 -0
- package/src/parser.c +186366 -168580
- package/src/scanner.c +3 -1
- package/tree-sitter-abl.wasm +0 -0
package/grammar.js
CHANGED
|
@@ -28,7 +28,8 @@ module.exports = grammar({
|
|
|
28
28
|
$._def_keyword,
|
|
29
29
|
$._var_keyword,
|
|
30
30
|
$._index_keyword,
|
|
31
|
-
$._field_keyword
|
|
31
|
+
$._field_keyword,
|
|
32
|
+
$._return_keyword
|
|
32
33
|
],
|
|
33
34
|
extras: ($) => [$.comment, /[\s\f\uFEFF\u2060\u200B]|\\\r?\n/],
|
|
34
35
|
word: ($) => $.identifier,
|
|
@@ -43,6 +44,7 @@ module.exports = grammar({
|
|
|
43
44
|
[$.size_phrase, $.frame_definition],
|
|
44
45
|
[$.dataset_expression, $.object_access],
|
|
45
46
|
[$.in_frame_phrase, $._expression],
|
|
47
|
+
[$.in_frame_phrase, $._message_statement_expression],
|
|
46
48
|
[$.include, $.constant],
|
|
47
49
|
[$.include_argument],
|
|
48
50
|
[$.include_argument, $._constant_value],
|
|
@@ -55,7 +57,7 @@ module.exports = grammar({
|
|
|
55
57
|
|
|
56
58
|
body: ($) => seq(":", repeat(choice($._statement, $._definition, $.do_block, prec(-1, $.annotation)))),
|
|
57
59
|
|
|
58
|
-
_statement_body: ($) => choice($.do_block, prec(2, $._statement)),
|
|
60
|
+
_statement_body: ($) => choice($.do_block, prec(2, $._statement), $.constant),
|
|
59
61
|
|
|
60
62
|
dot_body: ($) => seq(choice(":", "."), repeat(choice($._statement, $._definition))),
|
|
61
63
|
|
|
@@ -155,11 +157,16 @@ module.exports = grammar({
|
|
|
155
157
|
|
|
156
158
|
_name: ($) => choice($.identifier, $.qualified_name),
|
|
157
159
|
|
|
158
|
-
file_name: ($) => /[A-z-_|0-9|\/]+\.[
|
|
160
|
+
file_name: ($) => /[A-z-_|0-9|\/]+\.[ipwr]/i,
|
|
159
161
|
|
|
160
|
-
// TODO: FIX
|
|
162
|
+
// TODO: FIX
|
|
161
163
|
comment: ($) =>
|
|
162
164
|
choice(seq("//", /.*/), seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, "/")),
|
|
165
|
+
// Note: This was initial solution for comments inside comments. Does not work
|
|
166
|
+
// choice(
|
|
167
|
+
// seq("//", /.*/),
|
|
168
|
+
// seq("/*", repeat(choice(/[^*]/, /\*+[^/*]/)), /\*+\//)
|
|
169
|
+
// ),
|
|
163
170
|
|
|
164
171
|
annotation: ($) =>
|
|
165
172
|
seq(
|
|
@@ -376,6 +383,106 @@ module.exports = grammar({
|
|
|
376
383
|
kw("SUB-TOTAL")
|
|
377
384
|
),
|
|
378
385
|
|
|
386
|
+
_message_tuning: ($) =>
|
|
387
|
+
choice(
|
|
388
|
+
$.message_color,
|
|
389
|
+
$._message_alert_box,
|
|
390
|
+
$.message_update,
|
|
391
|
+
$.message_pause,
|
|
392
|
+
kw("NO-ERROR")
|
|
393
|
+
),
|
|
394
|
+
|
|
395
|
+
message_color: ($) =>
|
|
396
|
+
seq(
|
|
397
|
+
kw("COLOR"),
|
|
398
|
+
$.color_phrase
|
|
399
|
+
),
|
|
400
|
+
|
|
401
|
+
color_phrase: ($) =>
|
|
402
|
+
choice(
|
|
403
|
+
kw("NORMAL"),
|
|
404
|
+
kw("INPUT"),
|
|
405
|
+
kw("MESSAGES"),
|
|
406
|
+
seq(
|
|
407
|
+
optional(
|
|
408
|
+
choice(
|
|
409
|
+
kw("BLINK-"),
|
|
410
|
+
kw("RVV-"),
|
|
411
|
+
kw("UNDERLINE-"),
|
|
412
|
+
kw("BRIGHT-")
|
|
413
|
+
)
|
|
414
|
+
),
|
|
415
|
+
choice($.string_literal, $.identifier)
|
|
416
|
+
),
|
|
417
|
+
|
|
418
|
+
seq(
|
|
419
|
+
kw("VALUE"),
|
|
420
|
+
"(", $._expression,
|
|
421
|
+
")")
|
|
422
|
+
),
|
|
423
|
+
|
|
424
|
+
_message_alert_box: ($) =>
|
|
425
|
+
seq(
|
|
426
|
+
kw("VIEW-AS"),
|
|
427
|
+
kw("ALERT-BOX"),
|
|
428
|
+
optional($.alert_box_type),
|
|
429
|
+
optional($.alert_box_buttons),
|
|
430
|
+
optional(seq(kw("TITLE"), choice($.string_literal, $.additive_expression)))
|
|
431
|
+
),
|
|
432
|
+
|
|
433
|
+
alert_box_type: ($) =>
|
|
434
|
+
choice(
|
|
435
|
+
kw("MESSAGE"),
|
|
436
|
+
kw("INFORMATION"),
|
|
437
|
+
kw("INFO"),
|
|
438
|
+
kw("WARNING"),
|
|
439
|
+
kw("ERROR"),
|
|
440
|
+
kw("QUESTION")
|
|
441
|
+
),
|
|
442
|
+
|
|
443
|
+
alert_box_buttons: ($) =>
|
|
444
|
+
seq(
|
|
445
|
+
kw("BUTTONS"),
|
|
446
|
+
choice(
|
|
447
|
+
kw("OK"),
|
|
448
|
+
kw("CANCEL"),
|
|
449
|
+
kw("OK-CANCEL"),
|
|
450
|
+
kw("YES-NO"),
|
|
451
|
+
kw("YES-NO-CANCEL"),
|
|
452
|
+
kw("OK-HELP"),
|
|
453
|
+
kw("YES-NO-HELP"),
|
|
454
|
+
$.identifier,
|
|
455
|
+
$.string_literal
|
|
456
|
+
)
|
|
457
|
+
),
|
|
458
|
+
|
|
459
|
+
message_update: ($) =>
|
|
460
|
+
seq(
|
|
461
|
+
choice(
|
|
462
|
+
kw("UPDATE"),
|
|
463
|
+
kw("SET")
|
|
464
|
+
),
|
|
465
|
+
$._name,
|
|
466
|
+
repeat(
|
|
467
|
+
choice(
|
|
468
|
+
seq(
|
|
469
|
+
choice(
|
|
470
|
+
kw("AS"),
|
|
471
|
+
kw("LIKE")),
|
|
472
|
+
$._type
|
|
473
|
+
),
|
|
474
|
+
seq(
|
|
475
|
+
kw("FORMAT"),
|
|
476
|
+
$.string_literal
|
|
477
|
+
),
|
|
478
|
+
kw("AUTO-RETURN")
|
|
479
|
+
)
|
|
480
|
+
),
|
|
481
|
+
),
|
|
482
|
+
|
|
483
|
+
message_pause:($) => kw("PAUSE"),
|
|
484
|
+
|
|
485
|
+
|
|
379
486
|
// button_tuning: ($) =>
|
|
380
487
|
// choice(
|
|
381
488
|
// seq(kw("AUTO-GO"), optional(kw("AUTO-ENDKEY"))),
|
|
@@ -632,7 +739,7 @@ module.exports = grammar({
|
|
|
632
739
|
seq($._name, $.generic_expression),
|
|
633
740
|
|
|
634
741
|
return_type: ($) =>
|
|
635
|
-
seq(choice(kw("RETURNS"),
|
|
742
|
+
seq(choice(kw("RETURNS"), alias($._return_keyword, "RETURN")), field("type", $._type)),
|
|
636
743
|
|
|
637
744
|
member_modifier: ($) => choice(kw("ABSTRACT"), kw("OVERRIDE"), kw("FINAL")),
|
|
638
745
|
|
|
@@ -645,7 +752,7 @@ module.exports = grammar({
|
|
|
645
752
|
prec.right(
|
|
646
753
|
1,
|
|
647
754
|
seq(
|
|
648
|
-
field("array", choice($.identifier, $.object_access)),
|
|
755
|
+
field("array", choice($.identifier, $.qualified_name, $.object_access)),
|
|
649
756
|
$.array_literal,
|
|
650
757
|
)
|
|
651
758
|
),
|
|
@@ -672,7 +779,7 @@ module.exports = grammar({
|
|
|
672
779
|
choice(
|
|
673
780
|
$.ternary_expression,
|
|
674
781
|
seq(
|
|
675
|
-
choice($._name, $.object_access),
|
|
782
|
+
choice($._name, $.object_access, $.member_access),
|
|
676
783
|
optional($.type_tuning)
|
|
677
784
|
),
|
|
678
785
|
seq(
|
|
@@ -692,7 +799,8 @@ module.exports = grammar({
|
|
|
692
799
|
$.constant,
|
|
693
800
|
$._binary_expression,
|
|
694
801
|
$.unary_expression,
|
|
695
|
-
$.function_call
|
|
802
|
+
$.function_call,
|
|
803
|
+
$.boolean_literal
|
|
696
804
|
),
|
|
697
805
|
repeat($.parameter_tuning)
|
|
698
806
|
)
|
|
@@ -897,7 +1005,7 @@ module.exports = grammar({
|
|
|
897
1005
|
seq(kw("NEXT"), optional(field("label", $.identifier))),
|
|
898
1006
|
seq(kw("RETRY"), optional(field("label", $.identifier))),
|
|
899
1007
|
seq(
|
|
900
|
-
|
|
1008
|
+
alias($._return_keyword, "RETURN"),
|
|
901
1009
|
$._return_action
|
|
902
1010
|
)
|
|
903
1011
|
),
|
|
@@ -917,7 +1025,7 @@ module.exports = grammar({
|
|
|
917
1025
|
seq(
|
|
918
1026
|
$.assignment,
|
|
919
1027
|
kw("TO"),
|
|
920
|
-
choice($.function_call, $._integer_literal, $.
|
|
1028
|
+
choice($.function_call, $._integer_literal, $._name, $.object_access),
|
|
921
1029
|
optional(seq(kw("BY"), choice($._integer_literal, $.unary_expression)))
|
|
922
1030
|
),
|
|
923
1031
|
|
|
@@ -1515,7 +1623,7 @@ module.exports = grammar({
|
|
|
1515
1623
|
seq(
|
|
1516
1624
|
$._define,
|
|
1517
1625
|
optional(
|
|
1518
|
-
choice(alias($._input_keyword, "INPUT"), alias($._output_keyword, "OUTPUT"), kw("INPUT-OUTPUT"),
|
|
1626
|
+
choice(alias($._input_keyword, "INPUT"), alias($._output_keyword, "OUTPUT"), kw("INPUT-OUTPUT"), alias($._return_keyword, "RETURN"))
|
|
1519
1627
|
),
|
|
1520
1628
|
choice(kw("PARAMETER"), kw("PARAM")),
|
|
1521
1629
|
optional($._parameter_definition_option),
|
|
@@ -1665,6 +1773,27 @@ module.exports = grammar({
|
|
|
1665
1773
|
|
|
1666
1774
|
// STATEMENTS
|
|
1667
1775
|
|
|
1776
|
+
message_statement:($) =>
|
|
1777
|
+
seq(
|
|
1778
|
+
kw("MESSAGE"),
|
|
1779
|
+
repeat1(
|
|
1780
|
+
choice(
|
|
1781
|
+
$._message_statement_expression,
|
|
1782
|
+
seq(
|
|
1783
|
+
kw("SKIP"),
|
|
1784
|
+
optional(seq("(", $._integer_literal, ")"))
|
|
1785
|
+
)
|
|
1786
|
+
)
|
|
1787
|
+
),
|
|
1788
|
+
repeat($._message_tuning),
|
|
1789
|
+
optional(seq(
|
|
1790
|
+
kw("IN"),
|
|
1791
|
+
kw("WINDOW"),
|
|
1792
|
+
$._name
|
|
1793
|
+
)),
|
|
1794
|
+
$._terminator
|
|
1795
|
+
),
|
|
1796
|
+
|
|
1668
1797
|
null_statement: ($) => seq($.object_access, $._terminator),
|
|
1669
1798
|
|
|
1670
1799
|
using_statement: ($) =>
|
|
@@ -1813,7 +1942,7 @@ module.exports = grammar({
|
|
|
1813
1942
|
|
|
1814
1943
|
return_statement: ($) =>
|
|
1815
1944
|
seq(
|
|
1816
|
-
|
|
1945
|
+
alias($._return_keyword, "RETURN"),
|
|
1817
1946
|
optional($._return_action),
|
|
1818
1947
|
$._terminator
|
|
1819
1948
|
),
|
|
@@ -1848,7 +1977,7 @@ module.exports = grammar({
|
|
|
1848
1977
|
optional($.label),
|
|
1849
1978
|
alias($._for_keyword, "FOR"),
|
|
1850
1979
|
_list($._for_phrase, ","),
|
|
1851
|
-
repeat(choice($._on_phrase, $.frame_phrase)),
|
|
1980
|
+
repeat(choice($._on_phrase, $.frame_phrase, $.while_phrase)),
|
|
1852
1981
|
$.body,
|
|
1853
1982
|
$._block_terminator
|
|
1854
1983
|
),
|
|
@@ -1978,7 +2107,7 @@ module.exports = grammar({
|
|
|
1978
2107
|
kw("RUN"),
|
|
1979
2108
|
field(
|
|
1980
2109
|
"procedure",
|
|
1981
|
-
choice($._name, $.function_call, $.file_name)
|
|
2110
|
+
choice($._name, $.function_call, $.file_name, $.string_literal)
|
|
1982
2111
|
),
|
|
1983
2112
|
repeat($.run_tuning),
|
|
1984
2113
|
optional(alias($.function_arguments, $.arguments)),
|
|
@@ -2209,6 +2338,33 @@ module.exports = grammar({
|
|
|
2209
2338
|
$._binary_expression
|
|
2210
2339
|
),
|
|
2211
2340
|
|
|
2341
|
+
_message_statement_expression: ($) =>
|
|
2342
|
+
choice(
|
|
2343
|
+
$.unary_expression,
|
|
2344
|
+
$.null_expression,
|
|
2345
|
+
$.ternary_expression,
|
|
2346
|
+
$.available_expression,
|
|
2347
|
+
$.accumulate_expression,
|
|
2348
|
+
$.parenthesized_expression,
|
|
2349
|
+
$.ambiguous_expression,
|
|
2350
|
+
$.current_changed_expression,
|
|
2351
|
+
$.locked_expression,
|
|
2352
|
+
$.can_find_expression,
|
|
2353
|
+
$.additive_expression,
|
|
2354
|
+
$.multiplicative_expression,
|
|
2355
|
+
$.boolean_literal,
|
|
2356
|
+
$.string_literal,
|
|
2357
|
+
$.date_literal,
|
|
2358
|
+
$.number_literal,
|
|
2359
|
+
$.array_literal,
|
|
2360
|
+
$.object_access,
|
|
2361
|
+
$.member_access,
|
|
2362
|
+
$.array_access,
|
|
2363
|
+
$.function_call,
|
|
2364
|
+
$._name,
|
|
2365
|
+
$.constant
|
|
2366
|
+
),
|
|
2367
|
+
|
|
2212
2368
|
// SUPERTYPES
|
|
2213
2369
|
|
|
2214
2370
|
_expression: ($) =>
|
|
@@ -2248,6 +2404,7 @@ module.exports = grammar({
|
|
|
2248
2404
|
_statement: ($) =>
|
|
2249
2405
|
choice(
|
|
2250
2406
|
$.var_statement,
|
|
2407
|
+
$.message_statement,
|
|
2251
2408
|
$.null_statement,
|
|
2252
2409
|
$.procedure_statement,
|
|
2253
2410
|
$.function_statement,
|
|
@@ -2266,8 +2423,6 @@ module.exports = grammar({
|
|
|
2266
2423
|
$.undo_statement,
|
|
2267
2424
|
$.error_scope_statement,
|
|
2268
2425
|
$.using_statement,
|
|
2269
|
-
// $.class_statement,
|
|
2270
|
-
// $.interface_statement,
|
|
2271
2426
|
$.on_statement,
|
|
2272
2427
|
$.prompt_for_statement,
|
|
2273
2428
|
$.release_statement,
|
|
@@ -2275,10 +2430,7 @@ module.exports = grammar({
|
|
|
2275
2430
|
$.enum_statement,
|
|
2276
2431
|
$.abl_statement,
|
|
2277
2432
|
|
|
2278
|
-
// $._definition,
|
|
2279
|
-
|
|
2280
2433
|
$.variable_assignment,
|
|
2281
|
-
// $.do_block,
|
|
2282
2434
|
$.preprocessor_directive,
|
|
2283
2435
|
$.include,
|
|
2284
2436
|
$.annotation //TODO: Check should it be in supertype
|
package/package.json
CHANGED
package/parser.exp
CHANGED
|
Binary file
|
package/parser.lib
CHANGED
|
Binary file
|
package/parser.obj
CHANGED
|
Binary file
|
package/scanner.obj
CHANGED
|
Binary file
|