tree-sitter-abl 0.1.1 → 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 CHANGED
@@ -49,12 +49,13 @@ module.exports = grammar({
49
49
  [$.include_argument],
50
50
  [$.include_argument, $._constant_value],
51
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("//", /.*/), 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(
@@ -923,15 +963,18 @@ module.exports = grammar({
923
963
  alias($._index_keyword, "INDEX"),
924
964
  $.identifier,
925
965
  repeat($.index_tuning),
926
- repeat(seq(field("field", $.identifier), optional($.sort_order)))
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
 
@@ -1072,13 +1115,13 @@ module.exports = grammar({
1072
1115
  optional(choice(seq(kw("HORIZONTAL"), optional(kw("EXPAND"))), kw("VERTICAL"))),
1073
1116
  seq(
1074
1117
  kw("RADIO-BUTTONS"),
1075
- field("label", choice($.string_literal, $.identifier)),
1076
- ",",
1118
+ field("label", choice($.string_literal, $.identifier)),
1119
+ ",",
1077
1120
  field("value", choice($.string_literal, $.identifier, $._expression)),
1078
1121
  repeat(seq(
1079
- ",",
1080
- field("label", choice($.string_literal, $.identifier)),
1081
- ",",
1122
+ ",",
1123
+ field("label", choice($.string_literal, $.identifier)),
1124
+ ",",
1082
1125
  field("value", choice($.string_literal, $.identifier, $._expression))
1083
1126
  ))
1084
1127
  ),
@@ -1895,7 +1938,7 @@ module.exports = grammar({
1895
1938
  $.assignment_operator,
1896
1939
  prec.right(choice($._expression, $.include)),
1897
1940
  optional($.when_expression),
1898
- optional(seq(kw("IN"), $._frame))
1941
+ optional(seq(token.immediate(kw("IN")), $._frame)),
1899
1942
  )
1900
1943
  ),
1901
1944
 
@@ -1973,7 +2016,7 @@ module.exports = grammar({
1973
2016
  ),
1974
2017
  seq(
1975
2018
  kw("THROUGH"),
1976
- choice($.identifier, seq(kw("VALUE"), "(", $._expression, ")")),
2019
+ choice($.identifier, seq(kw("VALUE"), "(", $._expression, ")")),
1977
2020
  repeat(
1978
2021
  choice(
1979
2022
  $.identifier,
@@ -1982,7 +2025,7 @@ module.exports = grammar({
1982
2025
  seq(kw("VALUE"), "(", $._expression, ")")
1983
2026
  )
1984
2027
  ),
1985
- optional(seq(">", $.identifier))
2028
+ optional(seq(">", $.identifier))
1986
2029
  )
1987
2030
  ),
1988
2031
 
@@ -2184,6 +2227,33 @@ module.exports = grammar({
2184
2227
  )
2185
2228
  ),
2186
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
+
2187
2257
  // EXPRESSIONS
2188
2258
 
2189
2259
  null_expression: ($) => /\?/,
@@ -2353,7 +2423,7 @@ module.exports = grammar({
2353
2423
  $._binary_expression
2354
2424
  ),
2355
2425
 
2356
- _message_statement_expression: ($) =>
2426
+ _message_statement_expression: ($) =>
2357
2427
  choice(
2358
2428
  $.unary_expression,
2359
2429
  $.null_expression,
@@ -2443,6 +2513,7 @@ module.exports = grammar({
2443
2513
  $.release_statement,
2444
2514
  $.run_statement,
2445
2515
  $.enum_statement,
2516
+ $.update_statement,
2446
2517
  $.abl_statement,
2447
2518
 
2448
2519
  $.variable_assignment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-abl",
3
- "version": "0.1.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.exp CHANGED
Binary file
package/parser.lib CHANGED
Binary file
package/parser.obj CHANGED
Binary file
package/scanner.obj CHANGED
Binary file