@abaplint/core 2.94.8 → 2.94.10
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/adhoc/lexer_performance.ts +2 -3
- package/adhoc/parser_performance.ts +18 -0
- package/build/adhoc/lexer_performance.js +2 -3
- package/build/adhoc/parser_performance.d.ts +1 -0
- package/build/adhoc/parser_performance.js +18 -0
- package/build/src/abap/1_lexer/lexer.js +74 -68
- package/build/src/abap/2_statements/combi.js +12 -8
- package/build/src/abap/2_statements/expressions/data_definition.js +2 -2
- package/build/src/abap/2_statements/statement_parser.js +31 -24
- package/build/src/abap/2_statements/statements/assign.js +2 -2
- package/build/src/abap/2_statements/statements/break.js +1 -1
- package/build/src/abap/2_statements/statements/call_function.js +2 -2
- package/build/src/abap/2_statements/statements/class_data_begin.js +1 -1
- package/build/src/abap/2_statements/statements/class_data_end.js +1 -1
- package/build/src/abap/2_statements/statements/class_deferred.js +1 -2
- package/build/src/abap/2_statements/statements/class_definition.js +4 -4
- package/build/src/abap/2_statements/statements/class_local_friends.js +1 -2
- package/build/src/abap/2_statements/statements/clear.js +2 -2
- package/build/src/abap/2_statements/statements/concatenate.js +1 -1
- package/build/src/abap/2_statements/statements/data_end.js +1 -1
- package/build/src/abap/2_statements/statements/delete_database.js +3 -3
- package/build/src/abap/2_statements/statements/events.js +1 -1
- package/build/src/abap/2_statements/statements/find.js +2 -2
- package/build/src/abap/2_statements/statements/modify_line.js +1 -1
- package/build/src/abap/2_statements/statements/raise.js +1 -1
- package/build/src/abap/2_statements/statements/replace.js +2 -2
- package/build/src/abap/2_statements/statements/search.js +1 -1
- package/build/src/abap/2_statements/statements/sort.js +1 -1
- package/build/src/abap/2_statements/statements/translate.js +2 -2
- package/build/src/registry.js +1 -1
- package/build/src/rules/unused_variables.js +2 -2
- package/package.json +4 -3
|
@@ -10,8 +10,7 @@ for (let i = 0; i < 10; i++) {
|
|
|
10
10
|
const before = Date.now();
|
|
11
11
|
const result = new Lexer().run(file);
|
|
12
12
|
const runtime = Date.now() - before;
|
|
13
|
-
console.log("Runtime: " + runtime + "ms");
|
|
13
|
+
console.log("Runtime: " + runtime + "ms, Tokens: " + result.tokens.length);
|
|
14
14
|
total += runtime;
|
|
15
|
-
console.log("Tokens: " + result.tokens.length);
|
|
16
15
|
}
|
|
17
|
-
console.log("Total: " + total);
|
|
16
|
+
console.log("Total: " + total + "ms");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {MemoryFile, Version} from "../src";
|
|
2
|
+
import {Lexer} from "../src/abap/1_lexer/lexer";
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import {StatementParser} from "../src/abap/2_statements/statement_parser";
|
|
5
|
+
|
|
6
|
+
console.log("========================");
|
|
7
|
+
const file = new MemoryFile("abapgit.abap", fs.readFileSync("./lexer_performance.abap", "utf-8"));
|
|
8
|
+
|
|
9
|
+
const lexerResult = new Lexer().run(file);
|
|
10
|
+
|
|
11
|
+
let total = 0;
|
|
12
|
+
for (let i = 0; i < 4; i++) {
|
|
13
|
+
const before = Date.now();
|
|
14
|
+
new StatementParser(Version.v702).run([lexerResult], []);
|
|
15
|
+
const runtime = Date.now() - before;
|
|
16
|
+
total += runtime;
|
|
17
|
+
}
|
|
18
|
+
console.log("Total: " + total + "ms");
|
|
@@ -10,9 +10,8 @@ for (let i = 0; i < 10; i++) {
|
|
|
10
10
|
const before = Date.now();
|
|
11
11
|
const result = new lexer_1.Lexer().run(file);
|
|
12
12
|
const runtime = Date.now() - before;
|
|
13
|
-
console.log("Runtime: " + runtime + "ms");
|
|
13
|
+
console.log("Runtime: " + runtime + "ms, Tokens: " + result.tokens.length);
|
|
14
14
|
total += runtime;
|
|
15
|
-
console.log("Tokens: " + result.tokens.length);
|
|
16
15
|
}
|
|
17
|
-
console.log("Total: " + total);
|
|
16
|
+
console.log("Total: " + total + "ms");
|
|
18
17
|
//# sourceMappingURL=lexer_performance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const src_1 = require("../src");
|
|
4
|
+
const lexer_1 = require("../src/abap/1_lexer/lexer");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const statement_parser_1 = require("../src/abap/2_statements/statement_parser");
|
|
7
|
+
console.log("========================");
|
|
8
|
+
const file = new src_1.MemoryFile("abapgit.abap", fs.readFileSync("./lexer_performance.abap", "utf-8"));
|
|
9
|
+
const lexerResult = new lexer_1.Lexer().run(file);
|
|
10
|
+
let total = 0;
|
|
11
|
+
for (let i = 0; i < 4; i++) {
|
|
12
|
+
const before = Date.now();
|
|
13
|
+
new statement_parser_1.StatementParser(src_1.Version.v702).run([lexerResult], []);
|
|
14
|
+
const runtime = Date.now() - before;
|
|
15
|
+
total += runtime;
|
|
16
|
+
}
|
|
17
|
+
console.log("Total: " + total + "ms");
|
|
18
|
+
//# sourceMappingURL=parser_performance.js.map
|
|
@@ -9,6 +9,7 @@ class Buffer {
|
|
|
9
9
|
}
|
|
10
10
|
add(s) {
|
|
11
11
|
this.buf = this.buf + s;
|
|
12
|
+
return this.buf;
|
|
12
13
|
}
|
|
13
14
|
get() {
|
|
14
15
|
return this.buf;
|
|
@@ -300,39 +301,82 @@ class Lexer {
|
|
|
300
301
|
process(raw) {
|
|
301
302
|
this.stream = new Stream(raw.replace(/\r/g, ""));
|
|
302
303
|
this.buffer = new Buffer();
|
|
304
|
+
const splits = {};
|
|
305
|
+
splits[" "] = true;
|
|
306
|
+
splits[":"] = true;
|
|
307
|
+
splits["."] = true;
|
|
308
|
+
splits[","] = true;
|
|
309
|
+
splits["-"] = true;
|
|
310
|
+
splits["+"] = true;
|
|
311
|
+
splits["("] = true;
|
|
312
|
+
splits[")"] = true;
|
|
313
|
+
splits["["] = true;
|
|
314
|
+
splits["]"] = true;
|
|
315
|
+
splits["\t"] = true;
|
|
316
|
+
splits["\n"] = true;
|
|
317
|
+
const bufs = {};
|
|
318
|
+
bufs["."] = true;
|
|
319
|
+
bufs[","] = true;
|
|
320
|
+
bufs[":"] = true;
|
|
321
|
+
bufs["("] = true;
|
|
322
|
+
bufs[")"] = true;
|
|
323
|
+
bufs["["] = true;
|
|
324
|
+
bufs["]"] = true;
|
|
325
|
+
bufs["+"] = true;
|
|
326
|
+
bufs["@"] = true;
|
|
303
327
|
for (;;) {
|
|
304
328
|
const current = this.stream.currentChar();
|
|
305
|
-
this.buffer.add(current);
|
|
306
|
-
const buf = this.buffer.get();
|
|
329
|
+
const buf = this.buffer.add(current);
|
|
307
330
|
const ahead = this.stream.nextChar();
|
|
308
331
|
const aahead = this.stream.nextNextChar();
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
332
|
+
if (this.m === this.ModeNormal) {
|
|
333
|
+
if (ahead === "'") {
|
|
334
|
+
// start string
|
|
335
|
+
this.add();
|
|
336
|
+
this.m = this.ModeStr;
|
|
337
|
+
}
|
|
338
|
+
else if (ahead === "|" || ahead === "}") {
|
|
339
|
+
// start template
|
|
340
|
+
this.add();
|
|
341
|
+
this.m = this.ModeTemplate;
|
|
342
|
+
}
|
|
343
|
+
else if (ahead === "`") {
|
|
344
|
+
// start ping
|
|
345
|
+
this.add();
|
|
346
|
+
this.m = this.ModePing;
|
|
347
|
+
}
|
|
348
|
+
else if (aahead === "##") {
|
|
349
|
+
// start pragma
|
|
350
|
+
this.add();
|
|
351
|
+
this.m = this.ModePragma;
|
|
352
|
+
}
|
|
353
|
+
else if (ahead === "\""
|
|
354
|
+
|| (ahead === "*" && current === "\n")) {
|
|
355
|
+
// start comment
|
|
356
|
+
this.add();
|
|
357
|
+
this.m = this.ModeComment;
|
|
358
|
+
}
|
|
359
|
+
else if (splits[ahead]) {
|
|
360
|
+
this.add();
|
|
361
|
+
}
|
|
362
|
+
else if (ahead === "@" && buf.trim().length === 0) {
|
|
363
|
+
this.add();
|
|
364
|
+
}
|
|
365
|
+
else if (aahead === "->"
|
|
366
|
+
|| aahead === "=>") {
|
|
367
|
+
this.add();
|
|
368
|
+
}
|
|
369
|
+
else if (current === ">"
|
|
370
|
+
&& ahead !== " "
|
|
371
|
+
&& (this.stream.prevChar() === "-" || this.stream.prevChar() === "=")) {
|
|
372
|
+
// arrows
|
|
373
|
+
this.add();
|
|
374
|
+
}
|
|
375
|
+
else if (buf.length === 1
|
|
376
|
+
&& (bufs[buf]
|
|
377
|
+
|| (buf === "-" && ahead !== ">"))) {
|
|
378
|
+
this.add();
|
|
379
|
+
}
|
|
336
380
|
}
|
|
337
381
|
else if (this.m === this.ModePragma && (ahead === "," || ahead === ":" || ahead === "." || ahead === " " || ahead === "\n")) {
|
|
338
382
|
// end of pragma
|
|
@@ -357,7 +401,7 @@ class Lexer {
|
|
|
357
401
|
else if (this.m === this.ModeTemplate
|
|
358
402
|
&& buf.length > 1
|
|
359
403
|
&& (current === "|" || current === "{")
|
|
360
|
-
&& (
|
|
404
|
+
&& (this.stream.prevChar() !== "\\" || this.stream.prevPrevChar() === "\\\\")) {
|
|
361
405
|
// end of template
|
|
362
406
|
this.add();
|
|
363
407
|
this.m = this.ModeNormal;
|
|
@@ -377,24 +421,6 @@ class Lexer {
|
|
|
377
421
|
this.m = this.ModeNormal;
|
|
378
422
|
}
|
|
379
423
|
}
|
|
380
|
-
else if (this.m === this.ModeNormal
|
|
381
|
-
&& (ahead === " "
|
|
382
|
-
|| ahead === ":"
|
|
383
|
-
|| ahead === "."
|
|
384
|
-
|| ahead === ","
|
|
385
|
-
|| ahead === "-"
|
|
386
|
-
|| ahead === "+"
|
|
387
|
-
|| ahead === "("
|
|
388
|
-
|| ahead === ")"
|
|
389
|
-
|| ahead === "["
|
|
390
|
-
|| ahead === "]"
|
|
391
|
-
|| (ahead === "@" && buf.trim().length === 0)
|
|
392
|
-
|| aahead === "->"
|
|
393
|
-
|| aahead === "=>"
|
|
394
|
-
|| ahead === "\t"
|
|
395
|
-
|| ahead === "\n")) {
|
|
396
|
-
this.add();
|
|
397
|
-
}
|
|
398
424
|
else if (ahead === "\n" && this.m !== this.ModeTemplate) {
|
|
399
425
|
this.add();
|
|
400
426
|
this.m = this.ModeNormal;
|
|
@@ -402,26 +428,6 @@ class Lexer {
|
|
|
402
428
|
else if (this.m === this.ModeTemplate && current === "\n") {
|
|
403
429
|
this.add();
|
|
404
430
|
}
|
|
405
|
-
else if (current === ">"
|
|
406
|
-
&& (prev === "-" || prev === "=")
|
|
407
|
-
&& ahead !== " "
|
|
408
|
-
&& this.m === this.ModeNormal) {
|
|
409
|
-
// arrows
|
|
410
|
-
this.add();
|
|
411
|
-
}
|
|
412
|
-
else if (this.m === this.ModeNormal
|
|
413
|
-
&& (buf === "."
|
|
414
|
-
|| buf === ","
|
|
415
|
-
|| buf === ":"
|
|
416
|
-
|| buf === "("
|
|
417
|
-
|| buf === ")"
|
|
418
|
-
|| buf === "["
|
|
419
|
-
|| buf === "]"
|
|
420
|
-
|| buf === "+"
|
|
421
|
-
|| buf === "@"
|
|
422
|
-
|| (buf === "-" && ahead !== ">"))) {
|
|
423
|
-
this.add();
|
|
424
|
-
}
|
|
425
431
|
if (!this.stream.advance()) {
|
|
426
432
|
break;
|
|
427
433
|
}
|
|
@@ -301,7 +301,7 @@ class Star {
|
|
|
301
301
|
return [""];
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
class
|
|
304
|
+
class StarPriority {
|
|
305
305
|
constructor(sta) {
|
|
306
306
|
this.sta = sta;
|
|
307
307
|
}
|
|
@@ -373,7 +373,7 @@ class Plus {
|
|
|
373
373
|
class PlusPriority {
|
|
374
374
|
constructor(plu) {
|
|
375
375
|
this.plu = plu;
|
|
376
|
-
this.sub = new Sequence([this.plu, new
|
|
376
|
+
this.sub = new Sequence([this.plu, new StarPriority(this.plu)]);
|
|
377
377
|
}
|
|
378
378
|
listKeywords() {
|
|
379
379
|
return this.plu.listKeywords();
|
|
@@ -810,20 +810,24 @@ function tok(t) {
|
|
|
810
810
|
return new Token(t.name);
|
|
811
811
|
}
|
|
812
812
|
exports.tok = tok;
|
|
813
|
-
const
|
|
813
|
+
const expressionSingletons = {};
|
|
814
|
+
const stringSingletons = {};
|
|
814
815
|
function map(s) {
|
|
815
816
|
const type = typeof s;
|
|
816
817
|
if (type === "string") {
|
|
817
|
-
|
|
818
|
+
if (stringSingletons[s] === undefined) {
|
|
819
|
+
stringSingletons[s] = str(s);
|
|
820
|
+
}
|
|
821
|
+
return stringSingletons[s];
|
|
818
822
|
}
|
|
819
823
|
else if (type === "function") {
|
|
820
824
|
// @ts-ignore
|
|
821
825
|
const name = s.name;
|
|
822
|
-
if (
|
|
826
|
+
if (expressionSingletons[name] === undefined) {
|
|
823
827
|
// @ts-ignore
|
|
824
|
-
|
|
828
|
+
expressionSingletons[name] = new s();
|
|
825
829
|
}
|
|
826
|
-
return
|
|
830
|
+
return expressionSingletons[name];
|
|
827
831
|
}
|
|
828
832
|
else {
|
|
829
833
|
return s;
|
|
@@ -866,7 +870,7 @@ function star(first) {
|
|
|
866
870
|
}
|
|
867
871
|
exports.star = star;
|
|
868
872
|
function starPrio(first) {
|
|
869
|
-
return new
|
|
873
|
+
return new StarPriority(map(first));
|
|
870
874
|
}
|
|
871
875
|
exports.starPrio = starPrio;
|
|
872
876
|
function plus(first) {
|
|
@@ -6,8 +6,8 @@ const Expressions = require(".");
|
|
|
6
6
|
class DataDefinition extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
8
|
const simple = (0, combi_1.opt)((0, combi_1.per)("READ-ONLY", Expressions.Type, Expressions.Length, Expressions.Decimals, Expressions.Value));
|
|
9
|
-
const table = (0, combi_1.seq)(Expressions.TypeTable, (0, combi_1.
|
|
10
|
-
return (0, combi_1.seq)(Expressions.DefinitionName, (0, combi_1.
|
|
9
|
+
const table = (0, combi_1.seq)(Expressions.TypeTable, (0, combi_1.optPrio)("READ-ONLY"));
|
|
10
|
+
return (0, combi_1.seq)(Expressions.DefinitionName, (0, combi_1.optPrio)(Expressions.ConstantFieldLength), (0, combi_1.alt)(simple, table));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.DataDefinition = DataDefinition;
|
|
@@ -21,10 +21,10 @@ class StatementMap {
|
|
|
21
21
|
}
|
|
22
22
|
for (const first of f) {
|
|
23
23
|
if (this.map[first]) {
|
|
24
|
-
this.map[first].push(stat);
|
|
24
|
+
this.map[first].push({ statement: stat });
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
this.map[first] = [stat];
|
|
27
|
+
this.map[first] = [{ statement: stat }];
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -34,6 +34,11 @@ class StatementMap {
|
|
|
34
34
|
if (res === undefined) {
|
|
35
35
|
return [];
|
|
36
36
|
}
|
|
37
|
+
if (res[0].matcher === undefined) {
|
|
38
|
+
for (const r of res) {
|
|
39
|
+
r.matcher = r.statement.getMatcher();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
37
42
|
return res;
|
|
38
43
|
}
|
|
39
44
|
}
|
|
@@ -213,20 +218,20 @@ class StatementParser {
|
|
|
213
218
|
return new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));
|
|
214
219
|
}
|
|
215
220
|
for (const st of StatementParser.map.lookup(filtered[0].getStr())) {
|
|
216
|
-
const match = combi_1.Combi.run(st.
|
|
221
|
+
const match = combi_1.Combi.run(st.matcher, filtered, this.version);
|
|
217
222
|
if (match) {
|
|
218
223
|
const last = tokens[tokens.length - 1];
|
|
219
224
|
match.push(new nodes_1.TokenNode(last));
|
|
220
|
-
return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);
|
|
225
|
+
return new nodes_1.StatementNode(st.statement, statement.getColon(), pragmas).setChildren(match);
|
|
221
226
|
}
|
|
222
227
|
}
|
|
223
228
|
// next try the statements without specific keywords
|
|
224
229
|
for (const st of StatementParser.map.lookup("")) {
|
|
225
|
-
const match = combi_1.Combi.run(st.
|
|
230
|
+
const match = combi_1.Combi.run(st.matcher, filtered, this.version);
|
|
226
231
|
if (match) {
|
|
227
232
|
const last = tokens[tokens.length - 1];
|
|
228
233
|
match.push(new nodes_1.TokenNode(last));
|
|
229
|
-
return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);
|
|
234
|
+
return new nodes_1.StatementNode(st.statement, statement.getColon(), pragmas).setChildren(match);
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
237
|
return statement;
|
|
@@ -245,24 +250,26 @@ class StatementParser {
|
|
|
245
250
|
}
|
|
246
251
|
add.push(token);
|
|
247
252
|
const str = token.getStr();
|
|
248
|
-
if (str ===
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
colon
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
253
|
+
if (str.length === 1) {
|
|
254
|
+
if (str === ".") {
|
|
255
|
+
wa.addUnknown(pre, add, colon);
|
|
256
|
+
add = [];
|
|
257
|
+
pre = [];
|
|
258
|
+
colon = undefined;
|
|
259
|
+
}
|
|
260
|
+
else if (str === "," && pre.length > 0) {
|
|
261
|
+
wa.addUnknown(pre, add, colon);
|
|
262
|
+
add = [];
|
|
263
|
+
}
|
|
264
|
+
else if (str === ":" && colon === undefined) {
|
|
265
|
+
colon = token;
|
|
266
|
+
add.pop(); // do not add colon token to statement
|
|
267
|
+
pre.push(...add);
|
|
268
|
+
add = [];
|
|
269
|
+
}
|
|
270
|
+
else if (str === ":") {
|
|
271
|
+
add.pop(); // do not add colon token to statement
|
|
272
|
+
}
|
|
266
273
|
}
|
|
267
274
|
}
|
|
268
275
|
if (add.length > 0) {
|
|
@@ -5,8 +5,8 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const expressions_1 = require("../expressions");
|
|
6
6
|
class Assign {
|
|
7
7
|
getMatcher() {
|
|
8
|
-
const type = (0, combi_1.seq)("TYPE", (0, combi_1.
|
|
9
|
-
const like = (0, combi_1.seq)("LIKE", (0, combi_1.
|
|
8
|
+
const type = (0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(expressions_1.Dynamic, expressions_1.TypeName));
|
|
9
|
+
const like = (0, combi_1.seq)("LIKE", (0, combi_1.altPrio)(expressions_1.Dynamic, expressions_1.Source));
|
|
10
10
|
const handle = (0, combi_1.seq)("TYPE HANDLE", expressions_1.Source);
|
|
11
11
|
const range = (0, combi_1.seq)("RANGE", expressions_1.Source);
|
|
12
12
|
const decimals = (0, combi_1.seq)("DECIMALS", expressions_1.Source);
|
|
@@ -7,7 +7,7 @@ const version_1 = require("../../../version");
|
|
|
7
7
|
class Break {
|
|
8
8
|
getMatcher() {
|
|
9
9
|
const next = (0, combi_1.str)("AT NEXT APPLICATION STATEMENT");
|
|
10
|
-
const ret = (0, combi_1.
|
|
10
|
+
const ret = (0, combi_1.altPrio)((0, combi_1.seq)("BREAK-POINT", (0, combi_1.optPrio)((0, combi_1.altPrio)(next, expressions_1.Source))), (0, combi_1.seq)("BREAK", expressions_1.FieldSub));
|
|
11
11
|
return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -9,14 +9,14 @@ class CallFunction {
|
|
|
9
9
|
const starting = (0, combi_1.seq)("STARTING NEW TASK", expressions_1.SimpleSource2);
|
|
10
10
|
const update = (0, combi_1.str)("IN UPDATE TASK");
|
|
11
11
|
const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
|
|
12
|
-
const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.
|
|
12
|
+
const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.altPrio)("TASK", unit)));
|
|
13
13
|
const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodName, "ON END OF TASK");
|
|
14
14
|
const performing = (0, combi_1.seq)("PERFORMING", expressions_1.FormName, "ON END OF TASK");
|
|
15
15
|
const separate = (0, combi_1.str)("AS SEPARATE UNIT");
|
|
16
16
|
const keeping = (0, combi_1.str)("KEEPING LOGICAL UNIT OF WORK");
|
|
17
17
|
const options = (0, combi_1.per)(starting, update, background, expressions_1.Destination, calling, performing, separate, keeping);
|
|
18
18
|
const dynamic = (0, combi_1.seq)("PARAMETER-TABLE", expressions_1.Source, (0, combi_1.opt)((0, combi_1.seq)("EXCEPTION-TABLE", expressions_1.Source)));
|
|
19
|
-
const call = (0, combi_1.seq)("CALL", (0, combi_1.
|
|
19
|
+
const call = (0, combi_1.seq)("CALL", (0, combi_1.altPrio)("FUNCTION", (0, combi_1.verNot)(version_1.Version.Cloud, "CUSTOMER-FUNCTION")), expressions_1.FunctionName, (0, combi_1.opt)(options), (0, combi_1.alt)(expressions_1.FunctionParameters, dynamic));
|
|
20
20
|
return call;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
class ClassDataBegin {
|
|
7
7
|
getMatcher() {
|
|
8
8
|
const occurs = (0, combi_1.seq)("OCCURS", expressions_1.Integer);
|
|
9
|
-
const structure = (0, combi_1.seq)("BEGIN OF", (0, combi_1.
|
|
9
|
+
const structure = (0, combi_1.seq)("BEGIN OF", (0, combi_1.optPrio)("COMMON PART"), expressions_1.NamespaceSimpleName, (0, combi_1.optPrio)("READ-ONLY"), (0, combi_1.optPrio)(occurs));
|
|
10
10
|
return (0, combi_1.seq)("CLASS-DATA", structure);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
class ClassDataEnd {
|
|
7
7
|
getMatcher() {
|
|
8
8
|
const common = (0, combi_1.seq)("COMMON PART", (0, combi_1.optPrio)(expressions_1.NamespaceSimpleName));
|
|
9
|
-
const structure = (0, combi_1.seq)("END OF", (0, combi_1.
|
|
9
|
+
const structure = (0, combi_1.seq)("END OF", (0, combi_1.altPrio)(common, expressions_1.NamespaceSimpleName));
|
|
10
10
|
return (0, combi_1.seq)("CLASS-DATA", structure);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -5,8 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const expressions_1 = require("../expressions");
|
|
6
6
|
class ClassDeferred {
|
|
7
7
|
getMatcher() {
|
|
8
|
-
|
|
9
|
-
return (0, combi_1.seq)("CLASS", expressions_1.ClassName, (0, combi_1.str)("DEFINITION"), def);
|
|
8
|
+
return (0, combi_1.seq)("CLASS", expressions_1.ClassName, "DEFINITION DEFERRED", (0, combi_1.optPrio)("PUBLIC"));
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
exports.ClassDeferred = ClassDeferred;
|
|
@@ -6,13 +6,13 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
const version_1 = require("../../../version");
|
|
7
7
|
class ClassDefinition {
|
|
8
8
|
getMatcher() {
|
|
9
|
-
const create = (0, combi_1.seq)("CREATE", (0, combi_1.
|
|
10
|
-
const level = (0, combi_1.
|
|
9
|
+
const create = (0, combi_1.seq)("CREATE", (0, combi_1.altPrio)("PUBLIC", "PROTECTED", "PRIVATE"));
|
|
10
|
+
const level = (0, combi_1.altPrio)("CRITICAL", "HARMLESS", "DANGEROUS");
|
|
11
11
|
const risk = (0, combi_1.seq)("RISK LEVEL", level);
|
|
12
|
-
const time = (0, combi_1.
|
|
12
|
+
const time = (0, combi_1.altPrio)("LONG", "MEDIUM", "SHORT");
|
|
13
13
|
const duration = (0, combi_1.seq)("DURATION", time);
|
|
14
14
|
const blah = (0, combi_1.per)(expressions_1.ClassGlobal, expressions_1.ClassFinal, "ABSTRACT", (0, combi_1.seq)("INHERITING FROM", expressions_1.SuperClassName), create, "FOR TESTING", risk, "SHARED MEMORY ENABLED", duration, (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("FOR BEHAVIOR OF", expressions_1.NamespaceSimpleName)), expressions_1.ClassFriends);
|
|
15
|
-
const def = (0, combi_1.seq)("DEFINITION", (0, combi_1.
|
|
15
|
+
const def = (0, combi_1.seq)("DEFINITION", (0, combi_1.optPrio)(blah));
|
|
16
16
|
return (0, combi_1.seq)("CLASS", expressions_1.ClassName, def);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -5,8 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const expressions_1 = require("../expressions");
|
|
6
6
|
class ClassLocalFriends {
|
|
7
7
|
getMatcher() {
|
|
8
|
-
|
|
9
|
-
return (0, combi_1.seq)("CLASS", expressions_1.ClassName, "DEFINITION", local);
|
|
8
|
+
return (0, combi_1.seq)("CLASS", expressions_1.ClassName, "DEFINITION LOCAL FRIENDS", (0, combi_1.plusPrio)(expressions_1.ClassName));
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
exports.ClassLocalFriends = ClassLocalFriends;
|
|
@@ -6,8 +6,8 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
class Clear {
|
|
7
7
|
getMatcher() {
|
|
8
8
|
const wit = (0, combi_1.seq)("WITH", expressions_1.Source);
|
|
9
|
-
const mode = (0, combi_1.
|
|
10
|
-
return (0, combi_1.seq)("CLEAR", expressions_1.Target, (0, combi_1.
|
|
9
|
+
const mode = (0, combi_1.altPrio)("IN CHARACTER MODE", "IN BYTE MODE");
|
|
10
|
+
return (0, combi_1.seq)("CLEAR", expressions_1.Target, (0, combi_1.optPrio)(wit), (0, combi_1.optPrio)(mode));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.Clear = Clear;
|
|
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const expressions_1 = require("../expressions");
|
|
6
6
|
class Concatenate {
|
|
7
7
|
getMatcher() {
|
|
8
|
-
const mode = (0, combi_1.seq)("IN", (0, combi_1.
|
|
8
|
+
const mode = (0, combi_1.seq)("IN", (0, combi_1.altPrio)("BYTE", "CHARACTER"), "MODE");
|
|
9
9
|
const blanks = (0, combi_1.str)("RESPECTING BLANKS");
|
|
10
10
|
const sep = (0, combi_1.seq)("SEPARATED BY", expressions_1.Source);
|
|
11
11
|
const options = (0, combi_1.per)(mode, blanks, sep);
|
|
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
class DataEnd {
|
|
7
7
|
getMatcher() {
|
|
8
8
|
const common = (0, combi_1.seq)("COMMON PART", (0, combi_1.optPrio)(expressions_1.DefinitionName));
|
|
9
|
-
const structure = (0, combi_1.seq)("END OF", (0, combi_1.
|
|
9
|
+
const structure = (0, combi_1.seq)("END OF", (0, combi_1.altPrio)(common, expressions_1.DefinitionName));
|
|
10
10
|
const valid = (0, combi_1.seq)("VALID BETWEEN", expressions_1.ComponentName, "AND", expressions_1.ComponentName);
|
|
11
11
|
return (0, combi_1.seq)("DATA", structure, (0, combi_1.optPrio)(valid));
|
|
12
12
|
}
|
|
@@ -6,10 +6,10 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
const sql_client_1 = require("../expressions/sql_client");
|
|
7
7
|
class DeleteDatabase {
|
|
8
8
|
getMatcher() {
|
|
9
|
-
const where = (0, combi_1.seq)("WHERE", (0, combi_1.
|
|
9
|
+
const where = (0, combi_1.seq)("WHERE", (0, combi_1.altPrio)(expressions_1.SQLCond, expressions_1.Dynamic));
|
|
10
10
|
const from = (0, combi_1.seq)("FROM", expressions_1.DatabaseTable, (0, combi_1.optPrio)(sql_client_1.SQLClient), (0, combi_1.optPrio)(expressions_1.DatabaseConnection), (0, combi_1.opt)(where));
|
|
11
|
-
const table = (0, combi_1.seq)(expressions_1.DatabaseTable, (0, combi_1.optPrio)(sql_client_1.SQLClient), (0, combi_1.
|
|
12
|
-
const ret = (0, combi_1.seq)("DELETE", (0, combi_1.
|
|
11
|
+
const table = (0, combi_1.seq)(expressions_1.DatabaseTable, (0, combi_1.optPrio)(sql_client_1.SQLClient), (0, combi_1.optPrio)(expressions_1.DatabaseConnection), "FROM", (0, combi_1.opt)("TABLE"), expressions_1.SQLSourceSimple);
|
|
12
|
+
const ret = (0, combi_1.seq)("DELETE", (0, combi_1.altPrio)(from, table));
|
|
13
13
|
return ret;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
class Events {
|
|
7
7
|
getMatcher() {
|
|
8
8
|
const exporting = (0, combi_1.seq)("EXPORTING", (0, combi_1.plus)(expressions_1.MethodParamOptional));
|
|
9
|
-
return (0, combi_1.seq)((0, combi_1.
|
|
9
|
+
return (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-EVENTS", "EVENTS"), expressions_1.EventName, (0, combi_1.optPrio)(exporting));
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.Events = Events;
|
|
@@ -8,8 +8,8 @@ class Find {
|
|
|
8
8
|
// SUBMATCHES handling is a workaround
|
|
9
9
|
const options = (0, combi_1.per)("IGNORING CASE", "RESPECTING CASE", "IN BYTE MODE", "IN CHARACTER MODE", (0, combi_1.seq)("OF", expressions_1.Source), (0, combi_1.seq)("FROM", expressions_1.Source), (0, combi_1.seq)("TO", expressions_1.Source), (0, combi_1.seq)("MATCH OFFSET", expressions_1.Target), (0, combi_1.seq)("MATCH LINE", expressions_1.Target), (0, combi_1.seq)("MATCH COUNT", expressions_1.Target), (0, combi_1.seq)("MATCH LENGTH", expressions_1.Target), (0, combi_1.seq)("LENGTH", expressions_1.Source), (0, combi_1.seq)("RESULTS", expressions_1.Target), (0, combi_1.seq)("SUBMATCHES", expressions_1.Target), (0, combi_1.seq)("SUBMATCHES", expressions_1.Target, expressions_1.Target), (0, combi_1.seq)("SUBMATCHES", (0, combi_1.plus)(expressions_1.Target)));
|
|
10
10
|
const sectionLength = (0, combi_1.seq)("SECTION LENGTH", expressions_1.Source, "OF");
|
|
11
|
-
const before = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.
|
|
12
|
-
const ret = (0, combi_1.seq)("FIND", (0, combi_1.opt)((0, combi_1.
|
|
11
|
+
const before = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("TABLE", "SECTION OFFSET", sectionLength)), expressions_1.Source);
|
|
12
|
+
const ret = (0, combi_1.seq)("FIND", (0, combi_1.opt)((0, combi_1.altPrio)("FIRST OCCURRENCE OF", "ALL OCCURRENCES OF")), expressions_1.FindType, expressions_1.Source, "IN", before, (0, combi_1.opt)(options));
|
|
13
13
|
return ret;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -18,7 +18,7 @@ class ModifyLine {
|
|
|
18
18
|
const onOff = (0, combi_1.alt)("ON", "OFF");
|
|
19
19
|
const intensified = (0, combi_1.seq)("INTENSIFIED", onOff);
|
|
20
20
|
const options = (0, combi_1.per)(index, value, format, page, lineFormat, lineValue, ocp, intensified, expressions_1.Color);
|
|
21
|
-
const ret = (0, combi_1.seq)("MODIFY", (0, combi_1.
|
|
21
|
+
const ret = (0, combi_1.seq)("MODIFY", (0, combi_1.altPrio)("CURRENT LINE", (0, combi_1.seq)("LINE", expressions_1.Source)), (0, combi_1.opt)(options));
|
|
22
22
|
return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -10,7 +10,7 @@ class Raise {
|
|
|
10
10
|
const messid = (0, combi_1.seq)("MESSAGE ID", expressions_1.Source, "NUMBER", (0, combi_1.altPrio)(expressions_1.MessageNumber, expressions_1.Source), (0, combi_1.optPrio)(expressions_1.RaiseWith));
|
|
11
11
|
const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
|
|
12
12
|
const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
|
|
13
|
-
const pre = (0, combi_1.
|
|
13
|
+
const pre = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION"), "SHORTDUMP");
|
|
14
14
|
const clas = (0, combi_1.seq)(pre, (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
|
|
15
15
|
const ret = (0, combi_1.seq)("RAISE", (0, combi_1.altPrio)(clas, expressions_1.ExceptionName));
|
|
16
16
|
return ret;
|
|
@@ -9,12 +9,12 @@ class Replace {
|
|
|
9
9
|
const offset = (0, combi_1.seq)("OFFSET", expressions_1.Source);
|
|
10
10
|
const section = (0, combi_1.seq)((0, combi_1.opt)("IN"), "SECTION", (0, combi_1.per)(offset, length), "OF", expressions_1.Target);
|
|
11
11
|
const source = (0, combi_1.seq)((0, combi_1.opt)("OF"), expressions_1.FindType, expressions_1.Source);
|
|
12
|
-
const cas = (0, combi_1.
|
|
12
|
+
const cas = (0, combi_1.altPrio)("IGNORING CASE", "RESPECTING CASE");
|
|
13
13
|
const repl = (0, combi_1.seq)("REPLACEMENT COUNT", expressions_1.Target);
|
|
14
14
|
const replo = (0, combi_1.seq)("REPLACEMENT OFFSET", expressions_1.Target);
|
|
15
15
|
const repll = (0, combi_1.seq)("REPLACEMENT LENGTH", expressions_1.Target);
|
|
16
16
|
const repli = (0, combi_1.seq)("REPLACEMENT LINE", expressions_1.Target);
|
|
17
|
-
const occ = (0, combi_1.
|
|
17
|
+
const occ = (0, combi_1.altPrio)("ALL OCCURRENCES", "ALL OCCURENCES", "FIRST OCCURENCE", "FIRST OCCURRENCE");
|
|
18
18
|
const mode = (0, combi_1.alt)("IN CHARACTER MODE", "IN BYTE MODE");
|
|
19
19
|
const wit = (0, combi_1.seq)("WITH", expressions_1.Source);
|
|
20
20
|
const into = (0, combi_1.seq)("INTO", expressions_1.Target);
|
|
@@ -9,7 +9,7 @@ class Search {
|
|
|
9
9
|
const starting = (0, combi_1.seq)("STARTING AT", expressions_1.Source);
|
|
10
10
|
const ending = (0, combi_1.seq)("ENDING AT", expressions_1.Source);
|
|
11
11
|
const mark = (0, combi_1.str)("AND MARK");
|
|
12
|
-
const mode = (0, combi_1.
|
|
12
|
+
const mode = (0, combi_1.altPrio)("IN BYTE MODE", "IN CHARACTER MODE");
|
|
13
13
|
const ret = (0, combi_1.seq)("SEARCH", expressions_1.Source, "FOR", expressions_1.Source, (0, combi_1.opt)((0, combi_1.per)(mode, starting, ending, mark)));
|
|
14
14
|
return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
|
|
15
15
|
}
|
|
@@ -11,7 +11,7 @@ class Sort {
|
|
|
11
11
|
const fields = (0, combi_1.plus)((0, combi_1.seq)(sel, (0, combi_1.optPrio)(text), (0, combi_1.optPrio)(order), (0, combi_1.optPrio)(text)));
|
|
12
12
|
const by = (0, combi_1.seq)("BY", fields);
|
|
13
13
|
const normal = (0, combi_1.seq)(expressions_1.Target, (0, combi_1.opt)((0, combi_1.per)(order, by, "STABLE", text)));
|
|
14
|
-
const target = (0, combi_1.
|
|
14
|
+
const target = (0, combi_1.altPrio)(text, normal);
|
|
15
15
|
return (0, combi_1.seq)("SORT", target);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -5,9 +5,9 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const expressions_1 = require("../expressions");
|
|
6
6
|
class Translate {
|
|
7
7
|
getMatcher() {
|
|
8
|
-
const cas = (0, combi_1.seq)("TO", (0, combi_1.
|
|
8
|
+
const cas = (0, combi_1.seq)("TO", (0, combi_1.altPrio)("UPPER", "LOWER"), "CASE");
|
|
9
9
|
const using = (0, combi_1.seq)("USING", expressions_1.Source);
|
|
10
|
-
return (0, combi_1.seq)("TRANSLATE", expressions_1.Target, (0, combi_1.
|
|
10
|
+
return (0, combi_1.seq)("TRANSLATE", expressions_1.Target, (0, combi_1.altPrio)(cas, using));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.Translate = Translate;
|
package/build/src/registry.js
CHANGED
|
@@ -103,7 +103,7 @@ Unused variables are not reported if the object contains syntax errors. Errors f
|
|
|
103
103
|
const top = syntax.spaghetti.getTop();
|
|
104
104
|
this.buildWorkarea(top, obj);
|
|
105
105
|
if (this.workarea.count() === 0) {
|
|
106
|
-
return this.buildIssues(obj); // exit early if all
|
|
106
|
+
return this.buildIssues(obj); // exit early if all variables are used
|
|
107
107
|
}
|
|
108
108
|
this.findUses(top, obj);
|
|
109
109
|
for (const o of this.reg.getObjects()) {
|
|
@@ -117,7 +117,7 @@ Unused variables are not reported if the object contains syntax errors. Errors f
|
|
|
117
117
|
const syntax = new syntax_1.SyntaxLogic(this.reg, o).run();
|
|
118
118
|
this.findUses(syntax.spaghetti.getTop(), o);
|
|
119
119
|
if (this.workarea.count() === 0) {
|
|
120
|
-
return this.buildIssues(obj); // exit early if all
|
|
120
|
+
return this.buildIssues(obj); // exit early if all variables are used
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.94.
|
|
3
|
+
"version": "2.94.10",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"test:only": "npm run compile && mocha",
|
|
13
13
|
"test:parallel": "npm run compile && mocha --timeout 1000 --parallel --reporter dot",
|
|
14
14
|
"coverage": "npm run compile && c8 mocha && c8 report --reporter=html",
|
|
15
|
-
"lexer_performance": "tsc && curl -o lexer_performance.abap https://raw.githubusercontent.com/abapGit/build/main/
|
|
15
|
+
"lexer_performance": "tsc && curl -o lexer_performance.abap https://raw.githubusercontent.com/abapGit/build/main/zabapgit_standalone.prog.abap && node build/adhoc/lexer_performance.js",
|
|
16
|
+
"parser_performance": "tsc && curl -o lexer_performance.abap https://raw.githubusercontent.com/abapGit/build/main/zabapgit_standalone.prog.abap && node build/adhoc/parser_performance.js",
|
|
16
17
|
"schema": "node scripts/schema.js > scripts/schema.ts && ts-json-schema-generator --tsconfig tsconfig_schema.json --jsDoc extended --path scripts/schema.ts > scripts/schema.json && node scripts/schema_post.js",
|
|
17
18
|
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
18
19
|
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public"
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"@microsoft/api-extractor": "^7.33.7",
|
|
50
51
|
"@types/chai": "^4.3.4",
|
|
51
52
|
"@types/mocha": "^10.0.1",
|
|
52
|
-
"@types/node": "^18.11.
|
|
53
|
+
"@types/node": "^18.11.18",
|
|
53
54
|
"chai": "^4.3.7",
|
|
54
55
|
"eslint": "^8.30.0",
|
|
55
56
|
"mocha": "^10.2.0",
|