abl-tmlanguage 1.3.28 → 1.3.30
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/README.md +8 -9
- package/abl.tmLanguage.json +60 -79
- package/package.json +5 -2
- package/.github/workflows/ci.yml +0 -36
- package/CHANGELOG.md +0 -139
- package/abl-functions.txt +0 -548
- package/abl-keywords.txt +0 -416
- package/abl-methods.txt +0 -1053
- package/index.mjs +0 -508
- package/spec/analyze-suspend-resume/analyze-suspend-resume.spec.js +0 -17
- package/spec/annotations/annotation.spec.js +0 -366
- package/spec/array-extent/issue#5.spec.js +0 -26
- package/spec/blocks/block-labels.spec.js +0 -201
- package/spec/blocks/block-options.spec.js +0 -174
- package/spec/blocks/finally-blocks.spec.js +0 -90
- package/spec/blocks/on-quit.spec.js +0 -59
- package/spec/comments/comment-in-block-statement.spec.js +0 -153
- package/spec/comments/comment-in-for-each.spec.js +0 -105
- package/spec/comments/comment-in-function-args.spec.js +0 -88
- package/spec/comments/spacious-comment.spec.js +0 -73
- package/spec/comments/vscode-abl-issue#127.spec.js +0 -165
- package/spec/create-widgets/create-window.spec.js +0 -224
- package/spec/db-table-and-field/buffer-copy.spec.js +0 -246
- package/spec/db-table-and-field/create-alias.spec.js +0 -131
- package/spec/db-table-and-field/create-record.spec.js +0 -75
- package/spec/db-table-and-field/double-colon-access.spec.js +0 -154
- package/spec/db-table-and-field/field-in-function.spec.js +0 -58
- package/spec/db-table-and-field/fields-except.spec.js +0 -68
- package/spec/db-table-and-field/find-record.spec.js +0 -158
- package/spec/db-table-and-field/foreach.spec.js +0 -588
- package/spec/db-table-and-field/issue#88.spec.js +0 -121
- package/spec/db-table-and-field/new-record.spec.js +0 -250
- package/spec/db-table-and-field/query-get.spec.js +0 -137
- package/spec/define/define-browse.spec.js +0 -454
- package/spec/define/define-button.spec.js +0 -233
- package/spec/define/define-query.spec.js +0 -144
- package/spec/define/define-rectangle.spec.js +0 -47
- package/spec/define-buffer/create-buffer.spec.js +0 -212
- package/spec/define-buffer/simple-single-line.spec.js +0 -155
- package/spec/define-enum/type-name.spec.js +0 -200
- package/spec/define-event/simple-single-line.spec.js +0 -61
- package/spec/define-frame/issue#173.spec.js +0 -580
- package/spec/define-parameter/simple-single-line.spec.js +0 -228
- package/spec/define-property/property-getter.spec.js +0 -70
- package/spec/define-stream/simple-single-line.spec.js +0 -42
- package/spec/define-temp-table/define-dataset.spec.js +0 -217
- package/spec/define-temp-table/define-temp-table.spec.js +0 -605
- package/spec/define-variable/define-like.spec.js +0 -78
- package/spec/define-variable/extent.spec.js +0 -778
- package/spec/define-variable/initial.spec.js +0 -126
- package/spec/define-variable/issue#6.spec.js +0 -280
- package/spec/define-variable/issue#9.spec.js +0 -45
- package/spec/define-variable/simple-single-line.spec.js +0 -181
- package/spec/define-variable/single-line-with-a-comment-at-the-end.spec.js +0 -62
- package/spec/define-variable/single-line-with-a-space-and-a-comment-at-the-end.spec.js +0 -65
- package/spec/define-variable/tm-issue#2.spec.js +0 -25
- package/spec/define-variable/var-statement.spec.js +0 -467
- package/spec/do/do-blocks.spec.js +0 -289
- package/spec/do/issue#3.spec.js +0 -83
- package/spec/do/stop-after.spec.js +0 -79
- package/spec/for-each/for-each.spec.js +0 -111
- package/spec/for-each/issue#321.spec.js +0 -116
- package/spec/for-each/vscode-abl.issue#166.spec.js +0 -83
- package/spec/function-call/can-find.spec.js +0 -239
- package/spec/function-call/include-in-argument.spec.js +0 -120
- package/spec/function-call/misc-abl-functions.spec.js +0 -59
- package/spec/function-call/nested-functions.spec.js +0 -245
- package/spec/function-call/pass-table.spec.js +0 -116
- package/spec/function-call/set-size.spec.js +0 -56
- package/spec/function-call/udf-calls.spec.js +0 -50
- package/spec/function-call/vscode-abl-issue#19.spec.js +0 -129
- package/spec/function-definition/vscode-abl-issue#166.spec.js +0 -446
- package/spec/global-scoped-define/global-define.spec.js +0 -64
- package/spec/global-scoped-define/scoped-define-with-procedure-keyword.spec.js +0 -70
- package/spec/global-scoped-define/undefine.spec.js +0 -44
- package/spec/include/abl-tmlanguage-issues#5.spec.js +0 -40
- package/spec/include/include-file-name.spec.js +0 -267
- package/spec/include/unnamed-arguments.spec.js +0 -38
- package/spec/include/vscode-abl-issue#45.spec.js +0 -20
- package/spec/include/vscode-abl-issue#77.spec.js +0 -128
- package/spec/include/vscode-abl-issue#80.spec.js +0 -50
- package/spec/input-output/input-from.spec.js +0 -504
- package/spec/input-output/output-to.spec.js +0 -456
- package/spec/method-attribute-property-call/abl-method-attribute-call.spec.js +0 -98
- package/spec/method-attribute-property-call/connected-method.spec.js +0 -29
- package/spec/method-attribute-property-call/datset-table-attribute-method-call.spec.js +0 -53
- package/spec/method-attribute-property-call/get-set-method-name.spec.js +0 -140
- package/spec/method-attribute-property-call/method-call.spec.js +0 -268
- package/spec/method-attribute-property-call/nested-property-call.spec.js +0 -18
- package/spec/method-attribute-property-call/unqualified-method-call.spec.js +0 -41
- package/spec/method-definition/constructor.spec.js +0 -174
- package/spec/method-definition/method.spec.js +0 -541
- package/spec/misc-statements/array-for.spec.js +0 -21
- package/spec/misc-statements/case-statement.spec.js +0 -96
- package/spec/misc-statements/class-in-var-name.spec.js +0 -204
- package/spec/misc-statements/copy-lob.spec.js +0 -144
- package/spec/misc-statements/def-in-name.spec.js +0 -20
- package/spec/misc-statements/delete-objects.spec.js +0 -65
- package/spec/misc-statements/do-in-name.spec.js +0 -259
- package/spec/misc-statements/event-subscribe.spec.js +0 -308
- package/spec/misc-statements/export-delimiter.spec.js +0 -37
- package/spec/misc-statements/guid.spec.js +0 -97
- package/spec/misc-statements/if-then.spec.js +0 -454
- package/spec/misc-statements/issue#173.spec.js +0 -99
- package/spec/misc-statements/message-statement.spec.js +0 -21
- package/spec/misc-statements/record-buffer-functions.spec.js +0 -73
- package/spec/misc-statements/release.spec.js +0 -41
- package/spec/misc-statements/return-statement.spec.js +0 -64
- package/spec/misc-statements/skip-statement-and-fuction.spec.js +0 -35
- package/spec/misc-statements/system-handles.spec.js +0 -122
- package/spec/numbers/scientific-notation.spec.js +0 -212
- package/spec/operators/operators.spec.js +0 -149
- package/spec/operators/safe-navigation-operator.spec.js +0 -246
- package/spec/preprocesors/issue166.spec.js +0 -91
- package/spec/preprocesors/preprocessor-functions.spec.js +0 -77
- package/spec/preprocesors/proparse-preprocessor.spec.js +0 -90
- package/spec/procedure-definition/empty-proc.spec.js +0 -134
- package/spec/procedure-definition/trigger-procedure.spec.js +0 -132
- package/spec/procedure-definition/vscode-abl-issue#22.spec.js +0 -46
- package/spec/procedure-definition/vscode-abl-issue#26.spec.js +0 -31
- package/spec/procedure-definition/vscode-abl-issue#325.spec.js +0 -88
- package/spec/procedure-definition/vscode-abl-issue#62.spec.js +0 -39
- package/spec/run-statement/run-statement.spec.js +0 -868
- package/spec/shared.js +0 -104
- package/spec/strings/translation-attribute.spec.js +0 -52
- package/spec/strings/vscode-abl-issue#11.spec.js +0 -56
- package/spec/strings/vscode-abl-issue#28.spec.js +0 -31
- package/spec/type-name/argument.spec.js +0 -206
- package/spec/type-name/cast.spec.js +0 -163
- package/spec/type-name/define-class.spec.js +0 -555
- package/spec/type-name/define-enum.spec.js +0 -44
- package/spec/type-name/define-interface.spec.js +0 -159
- package/spec/type-name/define-property.spec.js +0 -301
- package/spec/type-name/define-temp-table.spec.js +0 -434
- package/spec/type-name/define-type-spec.js +0 -435
- package/spec/type-name/define-variable-property.spec.js +0 -264
- package/spec/type-name/define-variable.spec.js +0 -386
- package/spec/type-name/get-class.spec.js +0 -91
- package/spec/type-name/new.spec.js +0 -185
- package/spec/type-name/parameter-as.spec.js +0 -978
- package/spec/type-name/type-name.spec.js +0 -880
- package/spec/type-name/using.spec.js +0 -160
package/index.mjs
DELETED
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
// This script create 3 sections: keywords-<A-Z>, handle-attributes-<A-Z> and abl-functions-<A-Z> . ABL keywords can only be in
|
|
2
|
-
// one of these sections. The "keywords" section contains statements that are not in the attributes or function sections
|
|
3
|
-
// kwlist.txt file can be generated with `prowin -zgenkwlist > abl-keywords.txt`
|
|
4
|
-
//
|
|
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
|
-
// It will look something like:
|
|
7
|
-
// ACCELERATOR attribute
|
|
8
|
-
// ACCEPT-CHANGES( ) method
|
|
9
|
-
// ACCEPT-ROW-CHANGES( ) method
|
|
10
|
-
//
|
|
11
|
-
// abl-functions.txt can be created by copying the 'Related Links' from https://docs.progress.com/bundle/abl-reference/page/ABL-Syntax-Reference.html
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
import * as fs from 'node:fs';
|
|
15
|
-
import * as readline from 'node:readline';
|
|
16
|
-
import { optimize } from 'oniguruma-parser/optimizer';
|
|
17
|
-
|
|
18
|
-
let lineReaderMethods = readline.createInterface({
|
|
19
|
-
input: fs.createReadStream('abl-methods.txt')
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
let lineReaderFunctions = readline.createInterface({
|
|
23
|
-
input: fs.createReadStream('abl-functions.txt')
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
let lineReaderKeywords = readline.createInterface({
|
|
27
|
-
input: fs.createReadStream('abl-keywords.txt')
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
let output = 'grammar.json';
|
|
31
|
-
let result = {};
|
|
32
|
-
let attributeBlocks = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []];
|
|
33
|
-
let methodBlocks = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []];
|
|
34
|
-
let keywordBlocks = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []];
|
|
35
|
-
let functionBlocks = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []];
|
|
36
|
-
const re = /(?:\w|-|\()+(?=\s|$)/g
|
|
37
|
-
|
|
38
|
-
// The doc is not always accurate ...
|
|
39
|
-
// Add the full keyword to one of these arrays, and
|
|
40
|
-
// it and any abbreviated versions will be added to the
|
|
41
|
-
// appropriate scopes
|
|
42
|
-
let alsoStatements = [];
|
|
43
|
-
alsoStatements.push('ambiguous');
|
|
44
|
-
alsoStatements.push('asynchronous');
|
|
45
|
-
alsoStatements.push('auto-go');
|
|
46
|
-
alsoStatements.push('available');
|
|
47
|
-
alsoStatements.push('bgcolor');
|
|
48
|
-
alsoStatements.push('centered');
|
|
49
|
-
alsoStatements.push('column-label');
|
|
50
|
-
alsoStatements.push('context-help-id');
|
|
51
|
-
alsoStatements.push('dcolor');
|
|
52
|
-
alsoStatements.push('default-button');
|
|
53
|
-
alsoStatements.push('default');
|
|
54
|
-
alsoStatements.push('delete');
|
|
55
|
-
alsoStatements.push('delimiter');
|
|
56
|
-
alsoStatements.push('drop-target');
|
|
57
|
-
alsoStatements.push('edge-pixels');
|
|
58
|
-
alsoStatements.push('event-handler');
|
|
59
|
-
alsoStatements.push('event-procedure');
|
|
60
|
-
alsoStatements.push('fgcolor');
|
|
61
|
-
alsoStatements.push('first');
|
|
62
|
-
alsoStatements.push('flat-button');
|
|
63
|
-
alsoStatements.push('font');
|
|
64
|
-
alsoStatements.push('foreign-key-hidden');
|
|
65
|
-
alsoStatements.push('format');
|
|
66
|
-
alsoStatements.push('graphic-edge');
|
|
67
|
-
alsoStatements.push('help');
|
|
68
|
-
alsoStatements.push('hidden');
|
|
69
|
-
alsoStatements.push('image-down');
|
|
70
|
-
alsoStatements.push('image-insensitive');
|
|
71
|
-
alsoStatements.push('image-up');
|
|
72
|
-
alsoStatements.push('initial');
|
|
73
|
-
alsoStatements.push('keep-frame-z-order');
|
|
74
|
-
alsoStatements.push('label');
|
|
75
|
-
alsoStatements.push('locked');
|
|
76
|
-
alsoStatements.push('max-button');
|
|
77
|
-
alsoStatements.push('message-area');
|
|
78
|
-
alsoStatements.push('mouse-pointer');
|
|
79
|
-
alsoStatements.push('namespace-prefix');
|
|
80
|
-
alsoStatements.push('namespace-uri');
|
|
81
|
-
alsoStatements.push('nested');
|
|
82
|
-
alsoStatements.push('no-focus');
|
|
83
|
-
alsoStatements.push('page-bottom');
|
|
84
|
-
alsoStatements.push('persistent');
|
|
85
|
-
alsoStatements.push('pfcolor');
|
|
86
|
-
alsoStatements.push('recursive');
|
|
87
|
-
alsoStatements.push('resize');
|
|
88
|
-
alsoStatements.push('return-value');
|
|
89
|
-
alsoStatements.push('row');
|
|
90
|
-
alsoStatements.push('scroll-bars');
|
|
91
|
-
alsoStatements.push('scrollable');
|
|
92
|
-
alsoStatements.push('sensitive');
|
|
93
|
-
alsoStatements.push('separators');
|
|
94
|
-
alsoStatements.push('serialize-hidden');
|
|
95
|
-
alsoStatements.push('serialize-name');
|
|
96
|
-
alsoStatements.push('show-in-taskbar');
|
|
97
|
-
alsoStatements.push('side-labels');
|
|
98
|
-
alsoStatements.push('single-run');
|
|
99
|
-
alsoStatements.push('singleton');
|
|
100
|
-
alsoStatements.push('status-area');
|
|
101
|
-
alsoStatements.push('three-d');
|
|
102
|
-
alsoStatements.push('title');
|
|
103
|
-
alsoStatements.push('tooltip');
|
|
104
|
-
alsoStatements.push('transaction');
|
|
105
|
-
alsoStatements.push('value');
|
|
106
|
-
alsoStatements.push('view-as');
|
|
107
|
-
alsoStatements.push('warning');
|
|
108
|
-
alsoStatements.push('widget-id');
|
|
109
|
-
alsoStatements.push('write');
|
|
110
|
-
alsoStatements.push('xml-data-type');
|
|
111
|
-
alsoStatements.push('xml-node-name');
|
|
112
|
-
alsoStatements.push('xml-node-type');
|
|
113
|
-
|
|
114
|
-
let functionsNotStatements = [];
|
|
115
|
-
functionsNotStatements.push('set-size');
|
|
116
|
-
|
|
117
|
-
let alsoFunctions = [];
|
|
118
|
-
alsoFunctions.push('lower');
|
|
119
|
-
alsoFunctions.push('os-dir');
|
|
120
|
-
alsoFunctions.push('relation-fields');
|
|
121
|
-
alsoFunctions.push('return');
|
|
122
|
-
alsoFunctions.push('skip');
|
|
123
|
-
alsoFunctions.push('space');
|
|
124
|
-
alsoFunctions.push('substitute');
|
|
125
|
-
alsoFunctions.push('this-object');
|
|
126
|
-
alsoFunctions.push('value');
|
|
127
|
-
|
|
128
|
-
let noParameterFunctions = [];
|
|
129
|
-
noParameterFunctions.push('accum');
|
|
130
|
-
noParameterFunctions.push('ambiguous');
|
|
131
|
-
noParameterFunctions.push('available');
|
|
132
|
-
noParameterFunctions.push('current-changed');
|
|
133
|
-
noParameterFunctions.push('current-language');
|
|
134
|
-
noParameterFunctions.push('dataservers');
|
|
135
|
-
noParameterFunctions.push('dbname');
|
|
136
|
-
noParameterFunctions.push('entered');
|
|
137
|
-
noParameterFunctions.push('etime');
|
|
138
|
-
noParameterFunctions.push('frame-col');
|
|
139
|
-
noParameterFunctions.push('frame-db');
|
|
140
|
-
noParameterFunctions.push('frame-down');
|
|
141
|
-
noParameterFunctions.push('frame-field');
|
|
142
|
-
noParameterFunctions.push('frame-file');
|
|
143
|
-
noParameterFunctions.push('frame-index');
|
|
144
|
-
noParameterFunctions.push('frame-line');
|
|
145
|
-
noParameterFunctions.push('frame-name');
|
|
146
|
-
noParameterFunctions.push('frame-row');
|
|
147
|
-
noParameterFunctions.push('frame-value');
|
|
148
|
-
noParameterFunctions.push('gateways');
|
|
149
|
-
noParameterFunctions.push('generate-pbe-salt');
|
|
150
|
-
noParameterFunctions.push('generate-random-key');
|
|
151
|
-
noParameterFunctions.push('generate-uuid');
|
|
152
|
-
noParameterFunctions.push('get-codepages');
|
|
153
|
-
noParameterFunctions.push('go-pending');
|
|
154
|
-
noParameterFunctions.push('guid');
|
|
155
|
-
noParameterFunctions.push('input');
|
|
156
|
-
noParameterFunctions.push('is-attr-space');
|
|
157
|
-
noParameterFunctions.push('lastkey');
|
|
158
|
-
noParameterFunctions.push('line-counter');
|
|
159
|
-
noParameterFunctions.push('locked');
|
|
160
|
-
noParameterFunctions.push('message-lines');
|
|
161
|
-
noParameterFunctions.push('not entered');
|
|
162
|
-
noParameterFunctions.push('now');
|
|
163
|
-
noParameterFunctions.push('num-aliases');
|
|
164
|
-
noParameterFunctions.push('num-dbs');
|
|
165
|
-
noParameterFunctions.push('opsys');
|
|
166
|
-
noParameterFunctions.push('os-drives');
|
|
167
|
-
noParameterFunctions.push('os-error');
|
|
168
|
-
noParameterFunctions.push('page-number');
|
|
169
|
-
noParameterFunctions.push('page-size');
|
|
170
|
-
noParameterFunctions.push('proc-handle');
|
|
171
|
-
noParameterFunctions.push('proc-status');
|
|
172
|
-
noParameterFunctions.push('process-architecture');
|
|
173
|
-
noParameterFunctions.push('progress');
|
|
174
|
-
noParameterFunctions.push('promsgs');
|
|
175
|
-
noParameterFunctions.push('propath');
|
|
176
|
-
noParameterFunctions.push('proversion');
|
|
177
|
-
noParameterFunctions.push('retry');
|
|
178
|
-
noParameterFunctions.push('return');
|
|
179
|
-
noParameterFunctions.push('return-value');
|
|
180
|
-
noParameterFunctions.push('screen-lines');
|
|
181
|
-
noParameterFunctions.push('skip');
|
|
182
|
-
noParameterFunctions.push('super');
|
|
183
|
-
noParameterFunctions.push('terminal');
|
|
184
|
-
noParameterFunctions.push('time');
|
|
185
|
-
noParameterFunctions.push('today');
|
|
186
|
-
noParameterFunctions.push('transaction');
|
|
187
|
-
noParameterFunctions.push('userid');
|
|
188
|
-
|
|
189
|
-
let alsoKeywords = [];
|
|
190
|
-
alsoKeywords.push('get-collation'); //plural version as key
|
|
191
|
-
|
|
192
|
-
// The documentation does not reflect all abbreviations
|
|
193
|
-
let minKeywords = new Map();
|
|
194
|
-
minKeywords.set('log', 'logical');
|
|
195
|
-
minKeywords.set('&glob', '&global-define');
|
|
196
|
-
minKeywords.set('&scop', '&scoped-define');
|
|
197
|
-
minKeywords.set('glob', 'global');
|
|
198
|
-
minKeywords.set('var', 'variable');
|
|
199
|
-
|
|
200
|
-
// This holds the keyword names and their regex entries
|
|
201
|
-
let keywordEntries = new Map();
|
|
202
|
-
keywordEntries.set('logical', 'logical|logica|logic|logi|log|lo');
|
|
203
|
-
keywordEntries.set('&global-define', '&global-define|&global-defin|&global-defi|&global-def|&global-de|&global-d|&global-|&global|&globa|&glob)');
|
|
204
|
-
keywordEntries.set('&scoped-define', '&scoped-define|&scoped-defin|&scoped-defi|&scoped-def|&scoped-de|&scoped-d|&scoped-|&scoped|&scope|&scop');
|
|
205
|
-
keywordEntries.set('global', 'global|globa|glob');
|
|
206
|
-
keywordEntries.set('variable', 'variable|variabl|variab|varia|vari|var');
|
|
207
|
-
|
|
208
|
-
lineReaderMethods.on('line', line => {
|
|
209
|
-
let results;
|
|
210
|
-
line = line.toLowerCase();
|
|
211
|
-
|
|
212
|
-
if (!line.startsWith("#")) {
|
|
213
|
-
let kw = line.split(' ');
|
|
214
|
-
let charIdx = kw[0].charCodeAt(0) - 97;
|
|
215
|
-
let keyWord = kw[0].split('(')[0];
|
|
216
|
-
|
|
217
|
-
if (kw.includes('attribute')) {
|
|
218
|
-
if (!attributeBlocks[charIdx].includes(keyWord)) {
|
|
219
|
-
attributeBlocks[charIdx].push(keyWord);
|
|
220
|
-
}
|
|
221
|
-
} else if (kw.includes('method')) {
|
|
222
|
-
if (!methodBlocks[charIdx].includes(keyWord)) {
|
|
223
|
-
methodBlocks[charIdx].push(keyWord);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (alsoStatements.includes(keyWord)) {
|
|
228
|
-
if (!keywordBlocks[charIdx].includes(keyWord)) {
|
|
229
|
-
keywordBlocks[charIdx].push(keyWord);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
if (alsoFunctions.includes(keyWord)) {
|
|
233
|
-
if (!functionBlocks[charIdx].includes(keyWord)) {
|
|
234
|
-
functionBlocks[charIdx].push(keyWord);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
lineReaderFunctions.on('line', line => {
|
|
241
|
-
let results;
|
|
242
|
-
line = line.toLowerCase();
|
|
243
|
-
|
|
244
|
-
// NOT ENTERED function is captured
|
|
245
|
-
// as NOT , which is an operator and not
|
|
246
|
-
// a function
|
|
247
|
-
if (line.startsWith("not entered")) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (!line.startsWith("#")) {
|
|
252
|
-
|
|
253
|
-
let kw = line.split(' ');
|
|
254
|
-
|
|
255
|
-
// This is to skip the FUNCTION statement
|
|
256
|
-
if (kw.includes('function') && !kw.includes('statement')) {
|
|
257
|
-
let kwName = kw[0];
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
// CAPS letter alphabet
|
|
261
|
-
let charIdx = kwName.charCodeAt(0) - 97;
|
|
262
|
-
|
|
263
|
-
if (!functionBlocks[charIdx].includes(kwName)) {
|
|
264
|
-
functionBlocks[charIdx].push(kwName);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (alsoStatements.includes(kwName)) {
|
|
268
|
-
if (!keywordBlocks[charIdx].includes(kwName)) {
|
|
269
|
-
keywordBlocks[charIdx].push(kwName);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
} else if (kw.includes('statement')) {
|
|
273
|
-
for (const keyWord of kw) {
|
|
274
|
-
let charIdx = keyWord.charCodeAt(0) - 97;
|
|
275
|
-
|
|
276
|
-
if (keyWord == "statement") { break; }
|
|
277
|
-
|
|
278
|
-
if (keyWord.indexOf('(') !== -1) { continue; }
|
|
279
|
-
|
|
280
|
-
let kw2 = keyWord.replace(",", "");
|
|
281
|
-
|
|
282
|
-
if (charIdx > 0 && functionsNotStatements.includes(kw2)) {
|
|
283
|
-
functionBlocks[charIdx].push(kw2);
|
|
284
|
-
} else if (charIdx > 0 && !keywordBlocks[charIdx].includes(kw2)) {
|
|
285
|
-
keywordBlocks[charIdx].push(kw2);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
lineReaderKeywords.on('line', line => {
|
|
293
|
-
let results;
|
|
294
|
-
line = line.toLowerCase();
|
|
295
|
-
if (!line.startsWith("#")) {
|
|
296
|
-
while ((results = re.exec(line)) !== null) {
|
|
297
|
-
let kw = results[0];
|
|
298
|
-
// CAPS letter alphabet
|
|
299
|
-
let charIdx = kw.charCodeAt(0) - 97;
|
|
300
|
-
|
|
301
|
-
if (kw.indexOf('(') !== -1) {
|
|
302
|
-
let kwParts = kw.split('(');
|
|
303
|
-
let fullKw = kwParts[0] + kwParts[1];
|
|
304
|
-
let kwRegex = '';
|
|
305
|
-
for (let i = kwParts[1].length; i > 0; i--) {
|
|
306
|
-
kwRegex += kwParts[0] + kwParts[1].substring(0, i) + '|';
|
|
307
|
-
}
|
|
308
|
-
kwRegex += kwParts[0];
|
|
309
|
-
addToBlock(charIdx, fullKw, kwParts[0], kwRegex);
|
|
310
|
-
} else {
|
|
311
|
-
addToBlock(charIdx, kw, kw, kw);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
// Find an appropriate keyword regex
|
|
317
|
-
function getKwRegex(fullKw) {
|
|
318
|
-
let kwRegex = keywordEntries.get(fullKw);
|
|
319
|
-
|
|
320
|
-
if (kwRegex) {
|
|
321
|
-
return kwRegex;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (minKeywords.has(fullKw)) {
|
|
325
|
-
return keywordEntries.get(minKeywords.get(fullKw));
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if (alsoKeywords.includes(fullKw)) {
|
|
329
|
-
return fullKw;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// Adds the keyword regex to the relevant block
|
|
334
|
-
function addToBlock(charIdx, fullKw, minKw, kwRegex) {
|
|
335
|
-
// We will use these to resolve the full keywords later
|
|
336
|
-
if (!minKeywords.has(minKw)) {
|
|
337
|
-
minKeywords.set(minKw, fullKw);
|
|
338
|
-
}
|
|
339
|
-
if (!keywordEntries.has(fullKw)) {
|
|
340
|
-
keywordEntries.set(fullKw, kwRegex);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
if (!attributeBlocks[charIdx].includes(fullKw) &&
|
|
344
|
-
!methodBlocks[charIdx].includes(fullKw) &&
|
|
345
|
-
!functionBlocks[charIdx].includes(fullKw) &&
|
|
346
|
-
!keywordBlocks[charIdx].includes(fullKw)) {
|
|
347
|
-
keywordBlocks[charIdx].push(fullKw);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (alsoFunctions.includes(fullKw) &&
|
|
351
|
-
!functionBlocks[charIdx].includes(fullKw)) {
|
|
352
|
-
functionBlocks[charIdx].push(fullKw);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// Replaces full keywords in an array with the regexes, if any
|
|
357
|
-
function replaceKeywordsWithRegex(kwArray) {
|
|
358
|
-
let regexBlocks = [];
|
|
359
|
-
|
|
360
|
-
for (var idx in kwArray) {
|
|
361
|
-
regexBlocks[idx] = getKwRegex(kwArray[idx]);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
let cleanBlocks = regexBlocks.sort().filter(val => val).join('|');
|
|
365
|
-
|
|
366
|
-
// remove any empty entries before joining
|
|
367
|
-
// approach from https://stackoverflow.com/a/19903533/18177
|
|
368
|
-
return optimize(cleanBlocks).pattern;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
lineReaderFunctions.on('close', () => {
|
|
372
|
-
|
|
373
|
-
result['keywords'] = {
|
|
374
|
-
comment: "These scopes contain statements, not all the keywords. Methods, attributes and functions have their own scopes.",
|
|
375
|
-
patterns: [],
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
for (var zz = 0; zz < 26; zz++) {
|
|
379
|
-
|
|
380
|
-
if (keywordBlocks[zz].length > 0) {
|
|
381
|
-
result.keywords.patterns.push({ include: "#keywords-" + String.fromCharCode(97 + zz).toUpperCase() });
|
|
382
|
-
|
|
383
|
-
result['keywords-' + String.fromCharCode(97 + zz).toUpperCase()] =
|
|
384
|
-
{
|
|
385
|
-
comment: "The keyword must not have a trailing variable character (one of #$-_%&)",
|
|
386
|
-
match: "(?i)\\b(" + replaceKeywordsWithRegex(keywordBlocks[zz]) + ")\\b(?![#$\\-_%&])",
|
|
387
|
-
captures: {
|
|
388
|
-
1: {
|
|
389
|
-
name: "keyword.other.abl"
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
result['handle-attributes'] = { patterns: [] }
|
|
397
|
-
|
|
398
|
-
for (var zz = 0; zz < 26; zz++) {
|
|
399
|
-
if (attributeBlocks[zz].length > 0) {
|
|
400
|
-
|
|
401
|
-
result['handle-attributes'].patterns.push({ include: "#handle-attributes-" + String.fromCharCode(97 + zz).toUpperCase() });
|
|
402
|
-
|
|
403
|
-
result['handle-attributes-' + String.fromCharCode(97 + zz).toUpperCase()] =
|
|
404
|
-
{
|
|
405
|
-
match: "(?i)(:)(" + replaceKeywordsWithRegex(attributeBlocks[zz]) + ")\\b(?![#$\\-_%&])",
|
|
406
|
-
captures: {
|
|
407
|
-
1: {
|
|
408
|
-
name: "punctuation.separator.colon.abl"
|
|
409
|
-
},
|
|
410
|
-
2: {
|
|
411
|
-
name: "entity.name.function.abl"
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
result['handle-methods'] = { patterns: [] }
|
|
419
|
-
for (var zz = 0; zz < 26; zz++) {
|
|
420
|
-
|
|
421
|
-
if (methodBlocks[zz].length > 0) {
|
|
422
|
-
result['handle-methods'].patterns.push({ include: "#handle-methods-" + String.fromCharCode(97 + zz).toUpperCase() });
|
|
423
|
-
|
|
424
|
-
result['handle-methods-' + String.fromCharCode(97 + zz).toUpperCase()] =
|
|
425
|
-
{
|
|
426
|
-
begin: "(?i)(:)(" + replaceKeywordsWithRegex(methodBlocks[zz]) + ")\\s*(?=\\()",
|
|
427
|
-
beginCaptures: {
|
|
428
|
-
1: {
|
|
429
|
-
name: "punctuation.separator.colon.abl"
|
|
430
|
-
},
|
|
431
|
-
2: {
|
|
432
|
-
name: "support.function.abl"
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
end: "(\\))",
|
|
436
|
-
endCaptures: {
|
|
437
|
-
1: {
|
|
438
|
-
name: "meta.brace.round.js"
|
|
439
|
-
}
|
|
440
|
-
},
|
|
441
|
-
patterns: [
|
|
442
|
-
{
|
|
443
|
-
include: "#function-arguments"
|
|
444
|
-
}
|
|
445
|
-
]
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
result['abl-functions'] = { patterns: [] }
|
|
451
|
-
|
|
452
|
-
// turn noParameterFunctions into an alphabetically-sorted array
|
|
453
|
-
let noParameterFunctionBlocks = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []];
|
|
454
|
-
for (var zz = 0; zz < noParameterFunctions.length; zz++) {
|
|
455
|
-
let charIdx = noParameterFunctions[zz].charCodeAt(0) - 97;
|
|
456
|
-
noParameterFunctionBlocks[charIdx].push(noParameterFunctions[zz]);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
for (var zz = 0; zz < 26; zz++) {
|
|
460
|
-
|
|
461
|
-
if (functionBlocks[zz].length > 0) {
|
|
462
|
-
result['abl-functions'].patterns.push({ include: "#abl-functions-" + String.fromCharCode(97 + zz).toUpperCase() });
|
|
463
|
-
|
|
464
|
-
result['abl-functions-' + String.fromCharCode(97 + zz).toUpperCase()] =
|
|
465
|
-
{
|
|
466
|
-
begin: "(?i)\\s*(" + replaceKeywordsWithRegex(functionBlocks[zz]) + ")\\s*(?=\\()",
|
|
467
|
-
beginCaptures: {
|
|
468
|
-
1: {
|
|
469
|
-
name: "support.function.abl"
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
end: "(\\))",
|
|
473
|
-
endCaptures: {
|
|
474
|
-
1: {
|
|
475
|
-
name: "meta.brace.round.js"
|
|
476
|
-
}
|
|
477
|
-
},
|
|
478
|
-
patterns: [
|
|
479
|
-
{
|
|
480
|
-
include: "#function-arguments"
|
|
481
|
-
}
|
|
482
|
-
]
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
//Add functions without parens
|
|
488
|
-
let npfb = [];
|
|
489
|
-
for (var zz = 0; zz < 26; zz++) {
|
|
490
|
-
if (noParameterFunctionBlocks[zz].length > 0) {
|
|
491
|
-
npfb.push({
|
|
492
|
-
match: "(?i)\\b(" + replaceKeywordsWithRegex(noParameterFunctionBlocks[zz]) + ")(?!(\\.\\w+))(?=\\)|\\s|,|]|:|\\.)",
|
|
493
|
-
captures: {
|
|
494
|
-
1: {
|
|
495
|
-
name: "support.function.abl"
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
result['abl-functions'].patterns.push({
|
|
504
|
-
comment: "ABL functions that can be called without parentheses. Some functions have optional arguments, some are never called with parens",
|
|
505
|
-
patterns: npfb});
|
|
506
|
-
|
|
507
|
-
fs.writeFileSync(output, JSON.stringify(result, undefined, 4));
|
|
508
|
-
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const { assert, expect } = require('chai');
|
|
2
|
-
const shared = require('../shared.js');
|
|
3
|
-
|
|
4
|
-
describe('', () => {
|
|
5
|
-
let statement =
|
|
6
|
-
`&ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12
|
|
7
|
-
&ANALYZE-RESUME`;
|
|
8
|
-
|
|
9
|
-
let expectedTokens = [
|
|
10
|
-
[
|
|
11
|
-
{ "startIndex": 0, "endIndex": 17, "scopes": ["source.abl", "comment.preprocessor.analyze-suspend.abl"] },
|
|
12
|
-
{ "startIndex": 17, "endIndex": 42, "scopes": ["source.abl", "comment.preprocessor.analyze-suspend.abl"] }
|
|
13
|
-
], [
|
|
14
|
-
{ "startIndex": 0, "endIndex": 16, "scopes": ["source.abl", "comment.preprocessor.analyze-suspend.abl"] }
|
|
15
|
-
]];
|
|
16
|
-
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
|
|
17
|
-
})
|