abl-tmlanguage 1.3.3 → 1.3.5
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/abl-functions.txt +548 -0
- package/abl-keywords.txt +416 -0
- package/abl-methods.txt +1053 -0
- package/abl.tmLanguage.json +147 -12
- package/index.js +83 -59
- package/package.json +1 -1
- package/spec/blocks/block-labels.spec.js +25 -0
- package/spec/define-temp-table/define-dataset.spec.js +145 -0
- package/spec/define-temp-table/{define-index.spec.js → define-temp-table.spec.js} +81 -0
- package/spec/for-each/vscode-abl.issue#166.spec.js +83 -0
- package/spec/function-definition/vscode-abl-issue#166.spec.js +446 -0
- package/spec/method-attribute-property-call/method-call.spec.js +63 -0
- package/spec/misc-statements/record-buffer-functions.spec.js +73 -0
- package/spec/misc-statements/return-statement.spec.js +11 -0
- package/spec/operators/operators.spec.js +71 -0
package/abl.tmLanguage.json
CHANGED
|
@@ -76,9 +76,95 @@
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
+
"function-definition": {
|
|
80
|
+
"name": "meta.define.function.abl",
|
|
81
|
+
"begin": "(?i)\\b(function)\\s+([a-z0-9][a-z0-9#$\\-_%&]+)\\b",
|
|
82
|
+
"beginCaptures": {
|
|
83
|
+
"1": {
|
|
84
|
+
"name": "keyword.other.abl"
|
|
85
|
+
},
|
|
86
|
+
"2": {
|
|
87
|
+
"name": "entity.name.function.abl"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"end": "(\\.|\\:)",
|
|
91
|
+
"endCaptures": {
|
|
92
|
+
"1": {
|
|
93
|
+
"name": "punctuation.terminator.abl"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"patterns": [
|
|
97
|
+
{
|
|
98
|
+
"match": "(?i)\\b(map|to)\\s+(?!to\\s+)([a-z0-9][a-z0-9#$\\-_%&]+)\\b",
|
|
99
|
+
"captures": {
|
|
100
|
+
"1": {
|
|
101
|
+
"name": "keyword.other.abl"
|
|
102
|
+
},
|
|
103
|
+
"2": {
|
|
104
|
+
"name": "entity.name.function.abl"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"match": "(?i)\\b(returns|private|class|extent|in|super|forward|map)\\b",
|
|
110
|
+
"comment": "Captures the allowed keywords before the parenthesis. Some keywords are after the 'parens' when there are no parens used",
|
|
111
|
+
"captures": {
|
|
112
|
+
"1": {
|
|
113
|
+
"name": "keyword.other.abl"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"include": "#function-parameter-definition"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"include": "#parens"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"comment": "This captures everything after the parens, which may contain variables and methods",
|
|
125
|
+
"begin": "(?i)(?<=\\)|in)",
|
|
126
|
+
"end": "(?=(\\.|\\:)\\s)",
|
|
127
|
+
"patterns": [
|
|
128
|
+
{
|
|
129
|
+
"include": "#keywords"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"include": "#type-member-call"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"include": "#variable-name"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"include": "#comment"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"include": "#string"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"include": "#preprocessors"
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"include": "#primitive-type"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"include": "#type-name"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"include": "#keywords"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"include": "#comment"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"include": "#preprocessors"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
79
165
|
"method-definition": {
|
|
80
166
|
"name": "meta.define.method.abl",
|
|
81
|
-
"begin": "(?i)^\\s*(method|constructor)\\s*",
|
|
167
|
+
"begin": "(?i)^\\s*(method|constructor|destructor)\\s*",
|
|
82
168
|
"beginCaptures": {
|
|
83
169
|
"1": {
|
|
84
170
|
"name": "keyword.other.abl"
|
|
@@ -316,6 +402,9 @@
|
|
|
316
402
|
},
|
|
317
403
|
{
|
|
318
404
|
"include": "#comment"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"include": "#preprocessors"
|
|
319
408
|
}
|
|
320
409
|
]
|
|
321
410
|
},
|
|
@@ -343,6 +432,12 @@
|
|
|
343
432
|
"statements": {
|
|
344
433
|
"name": "meta.statements.abl",
|
|
345
434
|
"patterns": [
|
|
435
|
+
{
|
|
436
|
+
"include": "#function-definition"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"include": "#record-buffer-functions"
|
|
440
|
+
},
|
|
346
441
|
{
|
|
347
442
|
"include": "#release"
|
|
348
443
|
},
|
|
@@ -459,6 +554,9 @@
|
|
|
459
554
|
{
|
|
460
555
|
"include": "#timestamp-constant"
|
|
461
556
|
},
|
|
557
|
+
{
|
|
558
|
+
"include": "#break-by"
|
|
559
|
+
},
|
|
462
560
|
{
|
|
463
561
|
"include": "#for-join"
|
|
464
562
|
},
|
|
@@ -565,6 +663,21 @@
|
|
|
565
663
|
}
|
|
566
664
|
]
|
|
567
665
|
},
|
|
666
|
+
"break-by": {
|
|
667
|
+
"match": "(?i)\\s*((break)\\s+)?(by)\\s+(([\\w\\-#$%]+\\.)?([\\w\\-#$%]+\\.)([\\w\\-#$%]+)(\\[\\d+\\])?)\\b",
|
|
668
|
+
"comments": "The match needs a space capture before the BREAK, not a word break",
|
|
669
|
+
"captures": {
|
|
670
|
+
"2": {
|
|
671
|
+
"name": "keyword.other.abl"
|
|
672
|
+
},
|
|
673
|
+
"3": {
|
|
674
|
+
"name": "keyword.other.abl"
|
|
675
|
+
},
|
|
676
|
+
"4": {
|
|
677
|
+
"name": "storage.data.table.abl"
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
},
|
|
568
681
|
"preprocessors": {
|
|
569
682
|
"match": "(?i)(\\&[\\w-]*)|({\\&[\\w-]*})|(&window-system|&text-height|&line-number|&batch-mode|&file-name|&undefine|&sequence|&message|defined|&elseif|&scoped|&global|&opsys|&endif|&else|&scop|&then|&glob|&if)",
|
|
570
683
|
"captures": {
|
|
@@ -1185,6 +1298,24 @@
|
|
|
1185
1298
|
}
|
|
1186
1299
|
]
|
|
1187
1300
|
},
|
|
1301
|
+
"record-buffer-functions": {
|
|
1302
|
+
"comment": "this capture does not include the NOT function since it is impossible to determine whether this is a new class or a new record.",
|
|
1303
|
+
"match": "(?i)\\b(available|locked|ambiguous)\\s*(\\()?\\s*([\\w\\-#$%]+(\\.[\\w\\-#$%]+)?)\\s*(\\))?",
|
|
1304
|
+
"captures": {
|
|
1305
|
+
"1": {
|
|
1306
|
+
"name": "support.function.abl"
|
|
1307
|
+
},
|
|
1308
|
+
"2": {
|
|
1309
|
+
"name": "meta.brace.round.js"
|
|
1310
|
+
},
|
|
1311
|
+
"3": {
|
|
1312
|
+
"name": "support.data.table.abl"
|
|
1313
|
+
},
|
|
1314
|
+
"5": {
|
|
1315
|
+
"name": "meta.brace.round.js"
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1188
1319
|
"copy-lob": {
|
|
1189
1320
|
"comment": "Has its own rule because of the 'FOR length' option, which is parsed as a 'FOR EACH' type statement",
|
|
1190
1321
|
"begin": "(?i)\\b(copy-lob)\\b",
|
|
@@ -1301,6 +1432,9 @@
|
|
|
1301
1432
|
},
|
|
1302
1433
|
"code-block": {
|
|
1303
1434
|
"patterns": [
|
|
1435
|
+
{
|
|
1436
|
+
"include": "#record-buffer-functions"
|
|
1437
|
+
},
|
|
1304
1438
|
{
|
|
1305
1439
|
"include": "#comment"
|
|
1306
1440
|
},
|
|
@@ -2243,7 +2377,7 @@
|
|
|
2243
2377
|
}
|
|
2244
2378
|
},
|
|
2245
2379
|
"block-label": {
|
|
2246
|
-
"match": "(?i)^\\s*((
|
|
2380
|
+
"match": "(?i)^\\s*(?!(transaction|no-lock|exclusive-lock|exclusive-loc|exclusive-lo|exclusive-l|share-lock|share-loc|share-lo|share-|share):)([a-z][a-z0-9\\-\\$\\#]*)(:)\\s",
|
|
2247
2381
|
"comment": "A colon followed by a space is only legal is for block labels. Block labels must also be at the beginning of a line",
|
|
2248
2382
|
"captures": {
|
|
2249
2383
|
"2": {
|
|
@@ -3359,7 +3493,8 @@
|
|
|
3359
3493
|
}
|
|
3360
3494
|
},
|
|
3361
3495
|
"operator-with-space": {
|
|
3362
|
-
"match": "(?i)
|
|
3496
|
+
"match": "(?i)(?<=\\s)(not|contains|begins|matches|eq|le|lt|ge|gt|ne)(?=\\s|\\()",
|
|
3497
|
+
"comment": "Lookahead and -behind for the spaces, so that in particular the NOT is captured properly",
|
|
3363
3498
|
"captures": {
|
|
3364
3499
|
"1": {
|
|
3365
3500
|
"name": "keyword.operator.source.abl"
|
|
@@ -3446,7 +3581,7 @@
|
|
|
3446
3581
|
]
|
|
3447
3582
|
},
|
|
3448
3583
|
"keywords-A": {
|
|
3449
|
-
|
|
3584
|
+
"match": "(?i)\\b(avg|average|averag|avera|aver|ave|available|automatic|auto-endkey|authorization|audit-policy|audit-control|attribute-type|attachment|attach|at|assign|assembly|ask-overwrite|ascending|ascendin|ascendi|ascend|ascen|asce|asc|as-cursor|as|array-message|array-messag|array-messa|array-mess|array-mes|array-me|array-m|apply|application|append-line|append|anywhere|any-printable|any-key|any|ansi-only|and|ambiguous|alternate-key|alter|allow-replication|all|alert-box|aggregate|advise|add|active-window|active-form|across|accumulate|accumulat|accumula|accumul|accumu|accum|abstract|abort)\\b",
|
|
3450
3585
|
"captures": {
|
|
3451
3586
|
"1": {
|
|
3452
3587
|
"name": "keyword.other.abl"
|
|
@@ -3486,7 +3621,7 @@
|
|
|
3486
3621
|
}
|
|
3487
3622
|
},
|
|
3488
3623
|
"keywords-F": {
|
|
3489
|
-
|
|
3624
|
+
"match": "(?i)\\b(function-call-type|function|full-height|fromnoreorder|from-pixels|from-pixel|from-pixe|from-pix|from-pi|from-p|from-current|from-curren|from-curre|from-curr|from-cur|from-chars|from-char|from-cha|from-ch|from-c|from|frame-value|frame|forwards|forward|format|form|force-file|for|font-table|font|focus-in|focus|float|flags|fixed-only|fix-codepage|first|firehose-cursor|finder|find-wrap-around|find-select|find-previous|find-prev-occurrence|find-next-occurrence|find-next|find-global|find-case-sensitive|find|finally|final|filters|fill-in|filename|file-information|file-informatio|file-informati|file-informat|file-informa|file-inform|file-infor|file-info|file-access-time|file-access-tim|file-access-ti|file-access-t|file-access-date|file-access-dat|file-access-da|file-access-d|file|fields|field|fetch|false-leaks|false)\\b",
|
|
3490
3625
|
"captures": {
|
|
3491
3626
|
"1": {
|
|
3492
3627
|
"name": "keyword.other.abl"
|
|
@@ -3534,7 +3669,7 @@
|
|
|
3534
3669
|
}
|
|
3535
3670
|
},
|
|
3536
3671
|
"keywords-L": {
|
|
3537
|
-
"match": "(?i)\\b(lt|lookahead|longchar|longcha|longch|long|log-manager|log-id|lob-dir|load-result-into|load-picture|load-from|load|little-endian|listing|listin|listi|line-up|line-right|line-left|line-down|like-sequential|like|length|left-end|left-aligned|left-aligne|left-align|left|leave|leak-detection|leading|le|last-key|last-event|last-even|landscape|label-pfcolor|label-pfcolo|label-pfcol|label-pfco|label-pfc|label)\\b",
|
|
3672
|
+
"match": "(?i)\\b(lt|lookahead|longchar|longcha|longch|long|log-manager|log-id|locked|lob-dir|load-result-into|load-picture|load-from|load|little-endian|listing|listin|listi|line-up|line-right|line-left|line-down|like-sequential|like|length|left-end|left-aligned|left-aligne|left-align|left|leave|leak-detection|leading|le|last-key|last-event|last-even|landscape|label-pfcolor|label-pfcolo|label-pfcol|label-pfco|label-pfc|label)\\b",
|
|
3538
3673
|
"captures": {
|
|
3539
3674
|
"1": {
|
|
3540
3675
|
"name": "keyword.other.abl"
|
|
@@ -3550,7 +3685,7 @@
|
|
|
3550
3685
|
}
|
|
3551
3686
|
},
|
|
3552
3687
|
"keywords-N": {
|
|
3553
|
-
|
|
3688
|
+
"match": "(?i)\\b(numeric|num-selected|num-copies|null|not-active|not|none|non-serializable|node-type|no-word-wrap|no-wait|no-undo|no-underline|no-underlin|no-underli|no-underl|no-under|no-unde|no-und|no-tab-stop|no-tab-sto|no-tab-st|no-tab-s|no-tab-|no-tab|no-separators|no-separate-connection|no-scrolling|no-scrollbar-vertical|no-scrollbar-vertica|no-scrollbar-vertic|no-scrollbar-verti|no-scrollbar-vert|no-scrollbar-ver|no-scrollbar-ve|no-scrollbar-v|no-schema-marshall|no-schema-marshal|no-row-markers|no-return-value|no-return-valu|no-return-val|no-query-unique-added|no-query-unique-adde|no-query-unique-add|no-query-unique-ad|no-query-unique-a|no-query-unique-|no-query-unique|no-query-uniqu|no-query-uniq|no-query-uni|no-query-un|no-query-u|no-query-order-added|no-query-order-adde|no-query-order-add|no-query-order-ad|no-query-order-a|no-query-order-|no-query-order|no-query-orde|no-query-ord|no-query-or|no-query-o|no-prefetch|no-prefetc|no-prefet|no-prefe|no-pause|no-message|no-messag|no-messa|no-mess|no-mes|no-map|no-lookahead|no-lock|no-lobs|no-labels|no-label|no-keycache-join|no-join-by-sqldb|no-inherit-fgcolor|no-inherit-fgcolo|no-inherit-fgcol|no-inherit-fgco|no-inherit-fgc|no-inherit-bgcolor|no-inherit-bgcolo|no-inherit-bgcol|no-inherit-bgco|no-inherit-bgc|no-index-hint|no-hide|no-help|no-firehose-cursor|no-fill|no-fil|no-fi|no-f|no-error|no-echo|no-drag|no-debug|no-convert-3d-colors|no-convert-3d-color|no-convert-3d-colo|no-convert-3d-col|no-convert-3d-co|no-convert-3d-c|no-convert-3d-|no-convert-3d|no-convert|no-console|no-column-scrolling|no-column-scrollin|no-column-scrolli|no-column-scroll|no-column-scrol|no-column-scro|no-column-scr|no-column-sc|no-box|no-bind-where|no-auto-validate|no-auto-trim|no-auto-tri|no-attr-space|no-attr-spac|no-attr-spa|no-attr-sp|no-attr-s|no-attr-list|no-attr-lis|no-attr-li|no-attr-l|no-attr|no-assign|no-array-message|no-array-messag|no-array-messa|no-array-mess|no-array-mes|no-array-me|no-array-m|no-apply|no|next-word|next-prompt|next-frame|next-error|next|new-line|new-instance|new|nested|ne|native|namespace-uri|namespace-prefix)\\b",
|
|
3554
3689
|
"captures": {
|
|
3555
3690
|
"1": {
|
|
3556
3691
|
"name": "keyword.other.abl"
|
|
@@ -3582,7 +3717,7 @@
|
|
|
3582
3717
|
}
|
|
3583
3718
|
},
|
|
3584
3719
|
"keywords-R": {
|
|
3585
|
-
"match": "(?i)\\b(run-procedure|run-procedur|run-procedu|run-proced|run-proce|run-proc|run|rule-y|rule-row|rule|row-unmodified|row-of|row-modified|row-leave|row-height|row-entry|row-display|row-deleted|row-created|row|routine-level|right-end|right-aligned|right-aligne|right-align|right|revoke|revert|reverse-from|returns|return-to-start-dir|return-to-start-di|return|retry-cancel|retain|resume-display|result|request|reposition-parent-relation|reposition-parent-relatio|reposition-parent-relati|reposition-parent-relat|reposition-parent-rela|reposition-parent-rel|reposition-forwards|reposition-forward|reposition-forwar|reposition-forwa|reposition-forw|reposition-backwards|reposition-backward|reposition-backwar|reposition-backwa|reposition-backw|reposition-back|reposition|reports|replication-write|replication-delete|replication-create|repeat|release|reinstate|reference-only|rectangle|rectangl|rectang|rectan|recta|rect|recall|real|readkey|read-response|read-exact-num|read-available|rcode-information|rcode-informatio|rcode-informati|rcode-informat|rcode-informa|rcode-inform|rcode-infor|rcode-info|raw-transfer|raw|radio-set)\\b",
|
|
3720
|
+
"match": "(?i)\\b(run-procedure|run-procedur|run-procedu|run-proced|run-proce|run-proc|run|rule-y|rule-row|rule|row-unmodified|row-of|row-modified|row-leave|row-height|row-entry|row-display|row-deleted|row-created|row|routine-level|right-end|right-aligned|right-aligne|right-align|right|revoke|revert|reverse-from|returns|return-value|return-to-start-dir|return-to-start-di|return|retry-cancel|retain|resume-display|result|request|reposition-parent-relation|reposition-parent-relatio|reposition-parent-relati|reposition-parent-relat|reposition-parent-rela|reposition-parent-rel|reposition-forwards|reposition-forward|reposition-forwar|reposition-forwa|reposition-forw|reposition-backwards|reposition-backward|reposition-backwar|reposition-backwa|reposition-backw|reposition-back|reposition|reports|replication-write|replication-delete|replication-create|repeat|release|reinstate|reference-only|rectangle|rectangl|rectang|rectan|recta|rect|recall|real|readkey|read-response|read-exact-num|read-available|rcode-information|rcode-informatio|rcode-informati|rcode-informat|rcode-informa|rcode-inform|rcode-infor|rcode-info|raw-transfer|raw|radio-set)\\b",
|
|
3586
3721
|
"captures": {
|
|
3587
3722
|
"1": {
|
|
3588
3723
|
"name": "keyword.other.abl"
|
|
@@ -3630,7 +3765,7 @@
|
|
|
3630
3765
|
}
|
|
3631
3766
|
},
|
|
3632
3767
|
"keywords-X": {
|
|
3633
|
-
|
|
3768
|
+
"match": "(?i)\\b(xref-xml|xref|xor|xml-node-name|xcode|x-of|x-noderef|x-document)\\b",
|
|
3634
3769
|
"captures": {
|
|
3635
3770
|
"1": {
|
|
3636
3771
|
"name": "keyword.other.abl"
|
|
@@ -3638,7 +3773,7 @@
|
|
|
3638
3773
|
}
|
|
3639
3774
|
},
|
|
3640
3775
|
"keywords-Y": {
|
|
3641
|
-
"match": "(?i)\\b(yes-no-cancel|yes-no|yes|year-offset|y-of)\\b",
|
|
3776
|
+
"match": "(?i)\\b(yes-no-cancel|yes-no|yes|year-offset|year|y-of)\\b",
|
|
3642
3777
|
"captures": {
|
|
3643
3778
|
"1": {
|
|
3644
3779
|
"name": "keyword.other.abl"
|
|
@@ -4614,7 +4749,7 @@
|
|
|
4614
4749
|
},
|
|
4615
4750
|
"abl-functions-F": {
|
|
4616
4751
|
"name": "meta.function-call.abl",
|
|
4617
|
-
|
|
4752
|
+
"begin": "(?i)\\s*(frame-value|frame-valu|frame-val|frame-row|frame-name|frame-line|frame-index|frame-inde|frame-file|frame-field|frame-down|frame-db|frame-col|first-of|first|fill)\\s*(?=\\()",
|
|
4618
4753
|
"beginCaptures": {
|
|
4619
4754
|
"1": {
|
|
4620
4755
|
"name": "support.function.abl"
|
|
@@ -4754,7 +4889,7 @@
|
|
|
4754
4889
|
},
|
|
4755
4890
|
"abl-functions-N": {
|
|
4756
4891
|
"name": "meta.function-call.abl",
|
|
4757
|
-
|
|
4892
|
+
"begin": "(?i)\\s*(num-results|num-entries|num-dbs|num-aliases|num-aliase|num-alias|num-alia|num-ali|now|not entered|normalize|next-value|new)\\s*(?=\\()",
|
|
4758
4893
|
"beginCaptures": {
|
|
4759
4894
|
"1": {
|
|
4760
4895
|
"name": "support.function.abl"
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This script create 3 sections: keywords-<A>, handle-attributes-<Z> and abl-functions-<A> . ABL keywords can only be in
|
|
2
2
|
// one of these sections.
|
|
3
|
-
// kwlist.txt file can be generated with `prowin -zgenkwlist >
|
|
3
|
+
// kwlist.txt file can be generated with `prowin -zgenkwlist > abl-keywords.txt`
|
|
4
4
|
//
|
|
5
5
|
// methods.txt can be created by copying the 'Related Links' from https://docs.progress.com/bundle/abl-reference/page/Handle-Attributes-and-Methods-Reference.html//
|
|
6
6
|
// It will look something like:
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
const fs = require('fs');
|
|
15
15
|
|
|
16
16
|
let lineReaderMethods = require('readline').createInterface({
|
|
17
|
-
input: fs.createReadStream('methods.txt')
|
|
17
|
+
input: fs.createReadStream('abl-methods.txt')
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
let lineReaderFunctions = require('readline').createInterface({
|
|
@@ -22,7 +22,7 @@ let lineReaderFunctions = require('readline').createInterface({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
let lineReaderKeywords = require('readline').createInterface({
|
|
25
|
-
input: fs.createReadStream('
|
|
25
|
+
input: fs.createReadStream('abl-keywords.txt')
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
let output = 'grammar.json';
|
|
@@ -38,16 +38,25 @@ const re = /(?:\w|-|\()+(?=\s|$)/g
|
|
|
38
38
|
// it and any abbreviated versions will be added to the
|
|
39
39
|
// appropriate scopes
|
|
40
40
|
let alsoStatements = [];
|
|
41
|
+
alsoStatements.push('ambiguous');
|
|
42
|
+
alsoStatements.push('available');
|
|
41
43
|
alsoStatements.push('centered');
|
|
44
|
+
alsoStatements.push('delete');
|
|
42
45
|
alsoStatements.push('first');
|
|
43
46
|
alsoStatements.push('format');
|
|
44
47
|
alsoStatements.push('initial');
|
|
45
48
|
alsoStatements.push('label');
|
|
49
|
+
alsoStatements.push('locked');
|
|
50
|
+
alsoStatements.push('namespace-prefix');
|
|
51
|
+
alsoStatements.push('namespace-uri');
|
|
46
52
|
alsoStatements.push('nested');
|
|
53
|
+
alsoStatements.push('return-value');
|
|
47
54
|
alsoStatements.push('row');
|
|
48
55
|
alsoStatements.push('serialize-name');
|
|
49
56
|
alsoStatements.push('single-run');
|
|
50
57
|
alsoStatements.push('transaction');
|
|
58
|
+
alsoStatements.push('xml-node-name');
|
|
59
|
+
|
|
51
60
|
|
|
52
61
|
let functionsNotStatements = [];
|
|
53
62
|
functionsNotStatements.push('set-size');
|
|
@@ -64,28 +73,30 @@ lineReaderMethods.on('line', line => {
|
|
|
64
73
|
let results;
|
|
65
74
|
line = line.toLowerCase();
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
if (!line.startsWith("#")) {
|
|
77
|
+
let kw = line.split(' ');
|
|
78
|
+
let charIdx = kw[0].charCodeAt(0) - 97;
|
|
79
|
+
let keyWord = kw[0].split('(')[0];
|
|
70
80
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
if (kw.includes('attribute')) {
|
|
82
|
+
if (!attributeBlocks[charIdx].includes(keyWord)) {
|
|
83
|
+
attributeBlocks[charIdx].push(keyWord);
|
|
84
|
+
}
|
|
85
|
+
} else if (kw.includes('method')) {
|
|
86
|
+
if (!methodBlocks[charIdx].includes(keyWord)) {
|
|
87
|
+
methodBlocks[charIdx].push(keyWord);
|
|
88
|
+
}
|
|
78
89
|
}
|
|
79
|
-
}
|
|
80
90
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
if (alsoStatements.includes(keyWord)) {
|
|
92
|
+
if (!keywordBlocks[charIdx].includes(keyWord)) {
|
|
93
|
+
keywordBlocks[charIdx].push(keyWord);
|
|
94
|
+
}
|
|
84
95
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
if (alsoFunctions.includes(keyWord)) {
|
|
97
|
+
if (!functionBlocks[charIdx].includes(keyWord)) {
|
|
98
|
+
functionBlocks[charIdx].push(keyWord);
|
|
99
|
+
}
|
|
89
100
|
}
|
|
90
101
|
}
|
|
91
102
|
});
|
|
@@ -94,37 +105,49 @@ lineReaderFunctions.on('line', line => {
|
|
|
94
105
|
let results;
|
|
95
106
|
line = line.toLowerCase();
|
|
96
107
|
|
|
97
|
-
|
|
108
|
+
if (!line.startsWith("#")) {
|
|
98
109
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
let charIdx = kw[0].charCodeAt(0) - 97;
|
|
110
|
+
let kw = line.split(' ');
|
|
111
|
+
let kwName = '';
|
|
102
112
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
113
|
+
// This is to skip the FUNCTION statement
|
|
114
|
+
if (kw.includes('function') && !kw.includes('statement')) {
|
|
106
115
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
if (kw.includes('preprocessor')) {
|
|
117
|
+
kwName = kw[0];
|
|
118
|
+
} else {
|
|
119
|
+
kwName = kw.slice(0, kw.indexOf('function')).join(' ');
|
|
110
120
|
}
|
|
111
|
-
}
|
|
112
|
-
} else if (kw.includes('statement')) {
|
|
113
|
-
for (const keyWord of kw) {
|
|
114
|
-
let charIdx = keyWord.charCodeAt(0) - 97;
|
|
115
121
|
|
|
116
|
-
|
|
122
|
+
// CAPS letter alphabet
|
|
123
|
+
let charIdx = kwName.charCodeAt(0) - 97;
|
|
117
124
|
|
|
118
|
-
if (
|
|
125
|
+
if (!functionBlocks[charIdx].includes(kwName) && !kwName.includes('...')) {
|
|
126
|
+
functionBlocks[charIdx].push(kwName);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (alsoStatements.includes(kwName)) {
|
|
130
|
+
if (!keywordBlocks[charIdx].includes(kwName)) {
|
|
131
|
+
keywordBlocks[charIdx].push(kwName);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
} else if (kw.includes('statement')) {
|
|
135
|
+
for (const keyWord of kw) {
|
|
136
|
+
let charIdx = keyWord.charCodeAt(0) - 97;
|
|
137
|
+
|
|
138
|
+
if (keyWord == "statement") { break; }
|
|
139
|
+
|
|
140
|
+
if (keyWord.indexOf('(') !== -1) { continue; }
|
|
119
141
|
|
|
120
|
-
|
|
142
|
+
if (keyWord.includes('...')) { break; }
|
|
121
143
|
|
|
122
|
-
|
|
144
|
+
kw2 = keyWord.replace(",", "");
|
|
123
145
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
146
|
+
if (charIdx > 0 && functionsNotStatements.includes(kw2)) {
|
|
147
|
+
functionBlocks[charIdx].push(kw2);
|
|
148
|
+
} else if (charIdx > 0 && !keywordBlocks[charIdx].includes(kw2)) {
|
|
149
|
+
keywordBlocks[charIdx].push(kw2);
|
|
150
|
+
}
|
|
128
151
|
}
|
|
129
152
|
}
|
|
130
153
|
}
|
|
@@ -133,27 +156,28 @@ lineReaderFunctions.on('line', line => {
|
|
|
133
156
|
lineReaderKeywords.on('line', line => {
|
|
134
157
|
let results;
|
|
135
158
|
line = line.toLowerCase();
|
|
159
|
+
if (!line.startsWith("#")) {
|
|
160
|
+
while ((results = re.exec(line)) !== null) {
|
|
161
|
+
let kw = results[0];
|
|
162
|
+
// CAPS letter alphabet
|
|
163
|
+
let charIdx = kw.charCodeAt(0) - 97;
|
|
136
164
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
let charIdx = kw.charCodeAt(0) - 97;
|
|
141
|
-
|
|
142
|
-
if (kw.indexOf('(') !== -1) {
|
|
143
|
-
let kwParts = kw.split('(');
|
|
144
|
-
let fullKw = kwParts[0] + kwParts[1];
|
|
165
|
+
if (kw.indexOf('(') !== -1) {
|
|
166
|
+
let kwParts = kw.split('(');
|
|
167
|
+
let fullKw = kwParts[0] + kwParts[1];
|
|
145
168
|
|
|
146
|
-
|
|
147
|
-
|
|
169
|
+
kw = kwParts[0];
|
|
170
|
+
addToBlock(charIdx, fullKw, kw);
|
|
148
171
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
172
|
+
let kwComplete = kwParts[1];
|
|
173
|
+
for (const element of kwComplete) {
|
|
174
|
+
kw += element;
|
|
152
175
|
|
|
153
|
-
|
|
176
|
+
addToBlock(charIdx, fullKw, kw);
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
addToBlock(charIdx, kw, kw);
|
|
154
180
|
}
|
|
155
|
-
} else {
|
|
156
|
-
addToBlock(charIdx, kw, kw);
|
|
157
181
|
}
|
|
158
182
|
}
|
|
159
183
|
});
|
package/package.json
CHANGED
|
@@ -150,4 +150,29 @@ end.`;
|
|
|
150
150
|
]
|
|
151
151
|
]
|
|
152
152
|
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
describe('', () => {
|
|
156
|
+
let statement = `EXCLUSIVE-LOCK-BLOCK:
|
|
157
|
+
for bCustomer exclusive-lock:
|
|
158
|
+
end.`;
|
|
159
|
+
let expectedTokens = [
|
|
160
|
+
[
|
|
161
|
+
{ "startIndex": 0, "endIndex": 20, "scopes": ["source.abl", "meta.block.label.abl"] }, // 'EXCLUSIVE-LOCK-BLOCK'
|
|
162
|
+
{ "startIndex": 20, "endIndex": 21, "scopes": ["source.abl", "punctuation.terminator.abl"] } // ':'
|
|
163
|
+
],
|
|
164
|
+
[
|
|
165
|
+
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'for'
|
|
166
|
+
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
|
|
167
|
+
{ "startIndex": 4, "endIndex": 13, "scopes": ["source.abl", "storage.data.table.abl"] }, // 'bCustomer'
|
|
168
|
+
{ "startIndex": 13, "endIndex": 14, "scopes": ["source.abl"] }, // ' '
|
|
169
|
+
{ "startIndex": 14, "endIndex": 28, "scopes": ["source.abl", "keyword.other.abl"] }, // 'exclusive-lock'
|
|
170
|
+
{ "startIndex": 28, "endIndex": 29, "scopes": ["source.abl", "punctuation.terminator.abl"] } // ':'
|
|
171
|
+
],
|
|
172
|
+
[
|
|
173
|
+
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'end'
|
|
174
|
+
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
|
|
175
|
+
]
|
|
176
|
+
]
|
|
177
|
+
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
|
|
153
178
|
})
|