tree-sitter-abl 0.1.0 → 0.1.2
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 +113 -27
- package/package.json +1 -2
- package/parser.obj +0 -0
- package/scanner.obj +0 -0
- package/src/grammar.json +884 -91
- package/src/node-types.json +224 -21
- package/src/parser.c +235253 -194602
- package/test_on.p +7 -0
- package/tree-sitter-abl.wasm +0 -0
package/grammar.js
CHANGED
|
@@ -48,13 +48,14 @@ module.exports = grammar({
|
|
|
48
48
|
[$.include, $.constant],
|
|
49
49
|
[$.include_argument],
|
|
50
50
|
[$.include_argument, $._constant_value],
|
|
51
|
-
[$._literal, $._expression]
|
|
51
|
+
[$._literal, $._expression],
|
|
52
|
+
[$._update_space_skip]
|
|
52
53
|
],
|
|
53
54
|
|
|
54
55
|
rules: {
|
|
55
56
|
source_code: ($) => repeat(choice($._statement, $.class_statement, $._definition, $.do_block, $.interface_statement, $.method_statement, $.constant)),
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
|
|
58
59
|
body: ($) => seq(":", repeat(choice($._statement, $._definition, $.do_block, prec(-1, $.annotation)))),
|
|
59
60
|
|
|
60
61
|
_statement_body: ($) => choice($.do_block, prec(2, $._statement), $.constant),
|
|
@@ -161,7 +162,7 @@ module.exports = grammar({
|
|
|
161
162
|
|
|
162
163
|
// TODO: FIX
|
|
163
164
|
comment: ($) =>
|
|
164
|
-
choice(seq("//",
|
|
165
|
+
choice(seq("//", /[^\r\n]*/), seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, "/")),
|
|
165
166
|
// Note: This was initial solution for comments inside comments. Does not work
|
|
166
167
|
// choice(
|
|
167
168
|
// seq("//", /.*/),
|
|
@@ -317,7 +318,7 @@ module.exports = grammar({
|
|
|
317
318
|
|
|
318
319
|
include_file_path: ($) =>
|
|
319
320
|
prec.right(repeat1(choice(
|
|
320
|
-
$.constant,
|
|
321
|
+
$.constant,
|
|
321
322
|
/[A-z-_|0-9|\/\.]+/i
|
|
322
323
|
))),
|
|
323
324
|
|
|
@@ -334,7 +335,7 @@ module.exports = grammar({
|
|
|
334
335
|
seq("{", optional("&"), $._constant_value, "}"),
|
|
335
336
|
|
|
336
337
|
_constant_value: ($) => choice(
|
|
337
|
-
$.identifier,
|
|
338
|
+
$.identifier,
|
|
338
339
|
$._integer_literal,
|
|
339
340
|
seq($.identifier, "=", choice($.identifier, $._integer_literal, $.string_literal)),
|
|
340
341
|
seq($.identifier, repeat1(choice(/[\s\-()a-zA-Z0-9]+/)))
|
|
@@ -417,10 +418,10 @@ module.exports = grammar({
|
|
|
417
418
|
|
|
418
419
|
seq(
|
|
419
420
|
kw("VALUE"),
|
|
420
|
-
"(", $._expression,
|
|
421
|
+
"(", $._expression,
|
|
421
422
|
")")
|
|
422
423
|
),
|
|
423
|
-
|
|
424
|
+
|
|
424
425
|
_message_alert_box: ($) =>
|
|
425
426
|
seq(
|
|
426
427
|
kw("VIEW-AS"),
|
|
@@ -481,7 +482,46 @@ module.exports = grammar({
|
|
|
481
482
|
),
|
|
482
483
|
|
|
483
484
|
message_pause:($) => kw("PAUSE"),
|
|
484
|
-
|
|
485
|
+
|
|
486
|
+
update_tuning: ($) => choice(
|
|
487
|
+
$.comparison_expression,
|
|
488
|
+
$._update_field,
|
|
489
|
+
$._update_text,
|
|
490
|
+
$._update_constant,
|
|
491
|
+
"^",
|
|
492
|
+
$._update_space_skip
|
|
493
|
+
),
|
|
494
|
+
|
|
495
|
+
_update_field: ($) =>
|
|
496
|
+
seq(
|
|
497
|
+
$._name,
|
|
498
|
+
optional($._format),
|
|
499
|
+
optional($.when_expression)
|
|
500
|
+
),
|
|
501
|
+
|
|
502
|
+
_update_text: ($) =>
|
|
503
|
+
seq(
|
|
504
|
+
kw("TEXT"),
|
|
505
|
+
"(",
|
|
506
|
+
_list(seq($._name, optional($._format)), ","),
|
|
507
|
+
")"
|
|
508
|
+
),
|
|
509
|
+
_update_constant: ($) =>
|
|
510
|
+
seq(
|
|
511
|
+
$.constant,
|
|
512
|
+
optional(
|
|
513
|
+
choice(
|
|
514
|
+
seq(kw("AT"), $._expression),
|
|
515
|
+
seq(kw("TO"), $._expression)
|
|
516
|
+
)
|
|
517
|
+
)
|
|
518
|
+
),
|
|
519
|
+
|
|
520
|
+
_update_space_skip: ($) =>
|
|
521
|
+
seq(
|
|
522
|
+
choice(kw("SPACE"), kw("SKIP")),
|
|
523
|
+
optional(seq("(", $._integer_literal, ")"))
|
|
524
|
+
),
|
|
485
525
|
|
|
486
526
|
// button_tuning: ($) =>
|
|
487
527
|
// choice(
|
|
@@ -577,8 +617,8 @@ module.exports = grammar({
|
|
|
577
617
|
seq(kw("MAP"), $.identifier),
|
|
578
618
|
seq(
|
|
579
619
|
kw("CONVERT"),
|
|
580
|
-
optional(seq(kw("TARGET"), $.string_literal)),
|
|
581
|
-
optional(seq(kw("SOURCE"), $.string_literal))
|
|
620
|
+
optional(seq(kw("TARGET"), choice($.identifier, $.string_literal))),
|
|
621
|
+
optional(seq(kw("SOURCE"), choice($.identifier, $.string_literal)))
|
|
582
622
|
),
|
|
583
623
|
),
|
|
584
624
|
|
|
@@ -923,15 +963,18 @@ module.exports = grammar({
|
|
|
923
963
|
alias($._index_keyword, "INDEX"),
|
|
924
964
|
$.identifier,
|
|
925
965
|
repeat($.index_tuning),
|
|
926
|
-
repeat(
|
|
966
|
+
repeat($.index_field)
|
|
927
967
|
),
|
|
928
968
|
|
|
969
|
+
index_field: ($) =>
|
|
970
|
+
seq(field("field", $.identifier), optional($.sort_order)),
|
|
971
|
+
|
|
929
972
|
variable: ($) => choice(field("name", $.identifier), $.assignment),
|
|
930
973
|
|
|
931
974
|
enum_member: ($) =>
|
|
932
975
|
prec.right(
|
|
933
976
|
seq(
|
|
934
|
-
repeat($.annotation),
|
|
977
|
+
repeat($.annotation),
|
|
935
978
|
field("name", $.identifier),
|
|
936
979
|
field(
|
|
937
980
|
"value",
|
|
@@ -942,7 +985,7 @@ module.exports = grammar({
|
|
|
942
985
|
)
|
|
943
986
|
)
|
|
944
987
|
),
|
|
945
|
-
repeat($.annotation),
|
|
988
|
+
repeat($.annotation),
|
|
946
989
|
)
|
|
947
990
|
),
|
|
948
991
|
|
|
@@ -1025,7 +1068,8 @@ module.exports = grammar({
|
|
|
1025
1068
|
seq(
|
|
1026
1069
|
$.assignment,
|
|
1027
1070
|
kw("TO"),
|
|
1028
|
-
choice(
|
|
1071
|
+
optional(choice(kw("BROWSE"), kw("SELECTION-LIST"), kw("LIST-BOX"))),
|
|
1072
|
+
choice($.function_call, $._integer_literal, $._name, $.object_access, $.multiplicative_expression, $.additive_expression),
|
|
1029
1073
|
optional(seq(kw("BY"), choice($._integer_literal, $.unary_expression)))
|
|
1030
1074
|
),
|
|
1031
1075
|
|
|
@@ -1071,13 +1115,13 @@ module.exports = grammar({
|
|
|
1071
1115
|
optional(choice(seq(kw("HORIZONTAL"), optional(kw("EXPAND"))), kw("VERTICAL"))),
|
|
1072
1116
|
seq(
|
|
1073
1117
|
kw("RADIO-BUTTONS"),
|
|
1074
|
-
field("label", choice($.string_literal, $.identifier)),
|
|
1075
|
-
",",
|
|
1118
|
+
field("label", choice($.string_literal, $.identifier)),
|
|
1119
|
+
",",
|
|
1076
1120
|
field("value", choice($.string_literal, $.identifier, $._expression)),
|
|
1077
1121
|
repeat(seq(
|
|
1078
|
-
",",
|
|
1079
|
-
field("label", choice($.string_literal, $.identifier)),
|
|
1080
|
-
",",
|
|
1122
|
+
",",
|
|
1123
|
+
field("label", choice($.string_literal, $.identifier)),
|
|
1124
|
+
",",
|
|
1081
1125
|
field("value", choice($.string_literal, $.identifier, $._expression))
|
|
1082
1126
|
))
|
|
1083
1127
|
),
|
|
@@ -1871,7 +1915,7 @@ module.exports = grammar({
|
|
|
1871
1915
|
$._block_terminator
|
|
1872
1916
|
),
|
|
1873
1917
|
|
|
1874
|
-
variable_assignment: ($) => seq($.assignment, $._terminator),
|
|
1918
|
+
variable_assignment: ($) => seq($.assignment, optional(kw("NO-ERROR")), $._terminator),
|
|
1875
1919
|
|
|
1876
1920
|
assignment: ($) =>
|
|
1877
1921
|
prec.right(
|
|
@@ -1894,7 +1938,7 @@ module.exports = grammar({
|
|
|
1894
1938
|
$.assignment_operator,
|
|
1895
1939
|
prec.right(choice($._expression, $.include)),
|
|
1896
1940
|
optional($.when_expression),
|
|
1897
|
-
optional(seq(kw("IN"), $._frame))
|
|
1941
|
+
optional(seq(token.immediate(kw("IN")), $._frame)),
|
|
1898
1942
|
)
|
|
1899
1943
|
),
|
|
1900
1944
|
|
|
@@ -1928,7 +1972,7 @@ module.exports = grammar({
|
|
|
1928
1972
|
repeat($._repeat_phrase),
|
|
1929
1973
|
optional($.preselect_phrase),
|
|
1930
1974
|
optional($.while_phrase),
|
|
1931
|
-
|
|
1975
|
+
repeat($._on_phrase),
|
|
1932
1976
|
$.body,
|
|
1933
1977
|
$._block_terminator
|
|
1934
1978
|
),
|
|
@@ -1941,11 +1985,11 @@ module.exports = grammar({
|
|
|
1941
1985
|
),
|
|
1942
1986
|
|
|
1943
1987
|
return_statement: ($) =>
|
|
1944
|
-
seq(
|
|
1988
|
+
prec(1, seq(
|
|
1945
1989
|
alias($._return_keyword, "RETURN"),
|
|
1946
1990
|
optional($._return_action),
|
|
1947
1991
|
$._terminator
|
|
1948
|
-
),
|
|
1992
|
+
)),
|
|
1949
1993
|
|
|
1950
1994
|
input_output_statement: ($) =>
|
|
1951
1995
|
seq(
|
|
@@ -1957,8 +2001,8 @@ module.exports = grammar({
|
|
|
1957
2001
|
),
|
|
1958
2002
|
),
|
|
1959
2003
|
$._input_output_option,
|
|
1960
|
-
repeat($.stream_tuning),
|
|
1961
2004
|
repeat($.stream_flag),
|
|
2005
|
+
repeat($.stream_tuning),
|
|
1962
2006
|
optional($.constant),
|
|
1963
2007
|
$._terminator
|
|
1964
2008
|
),
|
|
@@ -1969,6 +2013,19 @@ module.exports = grammar({
|
|
|
1969
2013
|
seq(
|
|
1970
2014
|
choice(kw("FROM"), kw("TO")),
|
|
1971
2015
|
choice($.string_literal, $.function_call)
|
|
2016
|
+
),
|
|
2017
|
+
seq(
|
|
2018
|
+
kw("THROUGH"),
|
|
2019
|
+
choice($.identifier, seq(kw("VALUE"), "(", $._expression, ")")),
|
|
2020
|
+
repeat(
|
|
2021
|
+
choice(
|
|
2022
|
+
$.identifier,
|
|
2023
|
+
$.string_literal,
|
|
2024
|
+
$.number_literal,
|
|
2025
|
+
seq(kw("VALUE"), "(", $._expression, ")")
|
|
2026
|
+
)
|
|
2027
|
+
),
|
|
2028
|
+
optional(seq(">", $.identifier))
|
|
1972
2029
|
)
|
|
1973
2030
|
),
|
|
1974
2031
|
|
|
@@ -2109,6 +2166,7 @@ module.exports = grammar({
|
|
|
2109
2166
|
"procedure",
|
|
2110
2167
|
choice($._name, $.function_call, $.file_name, $.string_literal)
|
|
2111
2168
|
),
|
|
2169
|
+
optional($.function_call_argument),
|
|
2112
2170
|
repeat($.run_tuning),
|
|
2113
2171
|
optional(alias($.function_arguments, $.arguments)),
|
|
2114
2172
|
optional(kw("NO-ERROR")),
|
|
@@ -2129,7 +2187,7 @@ module.exports = grammar({
|
|
|
2129
2187
|
optional($.label),
|
|
2130
2188
|
kw("DO"),
|
|
2131
2189
|
repeat($._do_tuning),
|
|
2132
|
-
|
|
2190
|
+
repeat($._on_phrase),
|
|
2133
2191
|
optional($.frame_phrase),
|
|
2134
2192
|
$.body,
|
|
2135
2193
|
$._block_terminator
|
|
@@ -2169,6 +2227,33 @@ module.exports = grammar({
|
|
|
2169
2227
|
)
|
|
2170
2228
|
),
|
|
2171
2229
|
|
|
2230
|
+
update_statement: ($) => seq(
|
|
2231
|
+
kw("UPDATE"),
|
|
2232
|
+
optional(kw("UNLESS-HIDDEN")),
|
|
2233
|
+
repeat($.update_tuning),
|
|
2234
|
+
optional($.go_on_clause),
|
|
2235
|
+
optional($.frame_phrase),
|
|
2236
|
+
optional(kw("NO-ERROR")),
|
|
2237
|
+
$._terminator
|
|
2238
|
+
),
|
|
2239
|
+
|
|
2240
|
+
go_on_clause: ($) =>
|
|
2241
|
+
seq(
|
|
2242
|
+
kw("GO-ON"),
|
|
2243
|
+
"(",
|
|
2244
|
+
_list($.identifier, ","),
|
|
2245
|
+
")"
|
|
2246
|
+
),
|
|
2247
|
+
|
|
2248
|
+
editing_phrase: ($) =>
|
|
2249
|
+
seq(
|
|
2250
|
+
optional(seq($.identifier, ":")),
|
|
2251
|
+
kw("EDITING"),
|
|
2252
|
+
":",
|
|
2253
|
+
repeat(choice($._statement, $._definition)),
|
|
2254
|
+
kw("END")
|
|
2255
|
+
),
|
|
2256
|
+
|
|
2172
2257
|
// EXPRESSIONS
|
|
2173
2258
|
|
|
2174
2259
|
null_expression: ($) => /\?/,
|
|
@@ -2338,7 +2423,7 @@ module.exports = grammar({
|
|
|
2338
2423
|
$._binary_expression
|
|
2339
2424
|
),
|
|
2340
2425
|
|
|
2341
|
-
_message_statement_expression: ($) =>
|
|
2426
|
+
_message_statement_expression: ($) =>
|
|
2342
2427
|
choice(
|
|
2343
2428
|
$.unary_expression,
|
|
2344
2429
|
$.null_expression,
|
|
@@ -2428,6 +2513,7 @@ module.exports = grammar({
|
|
|
2428
2513
|
$.release_statement,
|
|
2429
2514
|
$.run_statement,
|
|
2430
2515
|
$.enum_statement,
|
|
2516
|
+
$.update_statement,
|
|
2431
2517
|
$.abl_statement,
|
|
2432
2518
|
|
|
2433
2519
|
$.variable_assignment,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-sitter-abl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "ABL grammar for tree-sitter",
|
|
5
5
|
"repository": "https://github.com/eglekaz/tree-sitter-abl",
|
|
6
6
|
"keywords": [
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"abl"
|
|
11
11
|
],
|
|
12
12
|
"main": "bindings/node",
|
|
13
|
-
|
|
14
13
|
"scripts": {
|
|
15
14
|
"generate": "tree-sitter generate",
|
|
16
15
|
"build": "tree-sitter generate && node-gyp build",
|
package/parser.obj
CHANGED
|
Binary file
|
package/scanner.obj
CHANGED
|
Binary file
|