@abaplint/core 2.93.84 → 2.93.86
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/build/src/abap/2_statements/statement_parser.js +1 -0
- package/build/src/abap/5_syntax/_current_scope.js +5 -5
- package/build/src/abap/types/_typed_identifier.js +3 -3
- package/build/src/cds/expressions/cds_arithmetics.js +2 -2
- package/build/src/cds/expressions/cds_case.js +2 -2
- package/build/src/cds/expressions/cds_element.js +1 -1
- package/build/src/cds/expressions/cds_function.js +3 -3
- package/build/src/config.js +24 -24
- package/build/src/issue.js +13 -13
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +2 -0
- package/package.json +2 -2
|
@@ -108,6 +108,7 @@ class StatementParser {
|
|
|
108
108
|
const concat = statement.concatTokens().toUpperCase();
|
|
109
109
|
if (concat.startsWith("CALL METHOD ") === false
|
|
110
110
|
&& concat.startsWith("RAISE EXCEPTION TYPE ") === false
|
|
111
|
+
&& concat.startsWith("LOOP AT ") === false
|
|
111
112
|
&& concat.startsWith("CALL FUNCTION ") === false) {
|
|
112
113
|
for (const { first, second } of this.buildSplits(statement.getTokens())) {
|
|
113
114
|
if (second.length === 1) {
|
|
@@ -10,11 +10,6 @@ const _scope_type_1 = require("./_scope_type");
|
|
|
10
10
|
const _reference_1 = require("./_reference");
|
|
11
11
|
const syntax_1 = require("./syntax");
|
|
12
12
|
class CurrentScope {
|
|
13
|
-
constructor(reg, obj) {
|
|
14
|
-
this.current = undefined;
|
|
15
|
-
this.parentObj = obj;
|
|
16
|
-
this.reg = reg;
|
|
17
|
-
}
|
|
18
13
|
static buildDefault(reg, obj) {
|
|
19
14
|
const s = new CurrentScope(reg, obj);
|
|
20
15
|
s.push(_scope_type_1.ScopeType.BuiltIn, _scope_type_1.ScopeType.BuiltIn, new position_1.Position(1, 1), _builtin_1.BuiltIn.filename);
|
|
@@ -34,6 +29,11 @@ class CurrentScope {
|
|
|
34
29
|
s.addType(t);
|
|
35
30
|
}
|
|
36
31
|
}
|
|
32
|
+
constructor(reg, obj) {
|
|
33
|
+
this.current = undefined;
|
|
34
|
+
this.parentObj = obj;
|
|
35
|
+
this.reg = reg;
|
|
36
|
+
}
|
|
37
37
|
///////////////////////////
|
|
38
38
|
getVersion() {
|
|
39
39
|
return this.reg.getConfig().getVersion();
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TypedIdentifier = void 0;
|
|
4
4
|
const _identifier_1 = require("../4_file_information/_identifier");
|
|
5
5
|
class TypedIdentifier extends _identifier_1.Identifier {
|
|
6
|
+
static from(id, type, meta) {
|
|
7
|
+
return new TypedIdentifier(id.getToken(), id.getFilename(), type, meta);
|
|
8
|
+
}
|
|
6
9
|
constructor(token, filename, type, meta, value) {
|
|
7
10
|
super(token, filename);
|
|
8
11
|
if (type instanceof TypedIdentifier) {
|
|
@@ -17,9 +20,6 @@ class TypedIdentifier extends _identifier_1.Identifier {
|
|
|
17
20
|
this.meta = meta;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
|
-
static from(id, type, meta) {
|
|
21
|
-
return new TypedIdentifier(id.getToken(), id.getFilename(), type, meta);
|
|
22
|
-
}
|
|
23
23
|
toText() {
|
|
24
24
|
return "Identifier: ```" + this.getName() + "```";
|
|
25
25
|
}
|
|
@@ -6,8 +6,8 @@ const combi_1 = require("../../abap/2_statements/combi");
|
|
|
6
6
|
class CDSArithmetics extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
8
|
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
-
const val = (0, combi_1.alt)((0, combi_1.regex)(
|
|
10
|
-
const operator = (0, combi_1.
|
|
9
|
+
const val = (0, combi_1.alt)((0, combi_1.regex)(/^\d+$/), name, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString);
|
|
10
|
+
const operator = (0, combi_1.altPrio)("+", "-", "*", "/");
|
|
11
11
|
return (0, combi_1.seq)(val, operator, val);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -5,11 +5,11 @@ const _1 = require(".");
|
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
6
|
class CDSCase extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.
|
|
8
|
+
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
9
|
const value = (0, combi_1.alt)(name, _1.CDSString, _1.CDSFunction, CDSCase, _1.CDSCast, _1.CDSArithmetics);
|
|
10
10
|
const simple = (0, combi_1.seq)("CASE", (0, combi_1.alt)(name, _1.CDSFunction), (0, combi_1.plus)((0, combi_1.seq)("WHEN", value, "THEN", value)), "ELSE", value, "END");
|
|
11
11
|
const complex = (0, combi_1.seq)("CASE", (0, combi_1.plus)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value)), (0, combi_1.opt)((0, combi_1.seq)("ELSE", value)), "END");
|
|
12
|
-
return (0, combi_1.
|
|
12
|
+
return (0, combi_1.altPrio)(simple, complex);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.CDSCase = CDSCase;
|
|
@@ -7,7 +7,7 @@ const cds_as_1 = require("./cds_as");
|
|
|
7
7
|
const cds_cast_1 = require("./cds_cast");
|
|
8
8
|
class CDSElement extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
|
-
return (0, combi_1.seq)((0, combi_1.
|
|
10
|
+
return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.altPrio)(cds_cast_1.CDSCast, _1.CDSAggregate, _1.CDSString, _1.CDSFunction, _1.CDSArithmetics, _1.CDSCase, (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)(_1.CDSParameters), (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName, (0, combi_1.opt)(_1.CDSParameters)))), (0, combi_1.regex)(/^\d+$/)), (0, combi_1.opt)(cds_as_1.CDSAs));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.CDSElement = CDSElement;
|
|
@@ -5,8 +5,8 @@ const _1 = require(".");
|
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
6
|
class CDSFunction extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
const qualified = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)(_1.CDSParameters), (0, combi_1.
|
|
9
|
-
const input = (0, combi_1.
|
|
8
|
+
const qualified = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)(_1.CDSParameters), (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.CDSName, (0, combi_1.opt)(_1.CDSParameters))));
|
|
9
|
+
const input = (0, combi_1.altPrio)(_1.CDSCast, CDSFunction, _1.CDSArithmetics, _1.CDSCase, _1.CDSString, qualified, (0, combi_1.regex)(/^\d+$/));
|
|
10
10
|
const coalesce = (0, combi_1.seq)("COALESCE", "(", input, ",", input, ")");
|
|
11
11
|
const concat = (0, combi_1.seq)("CONCAT", "(", input, ",", input, ")");
|
|
12
12
|
const concat_with_space = (0, combi_1.seq)("CONCAT_WITH_SPACE", "(", input, ",", input, ",", input, ")");
|
|
@@ -27,7 +27,7 @@ class CDSFunction extends combi_1.Expression {
|
|
|
27
27
|
const tstmp_add_seconds = (0, combi_1.seq)("TSTMP_ADD_SECONDS", "(", input, ",", input, ",", input, ")");
|
|
28
28
|
const abap_system_timezone = (0, combi_1.seq)("ABAP_SYSTEM_TIMEZONE", "(", input, ",", input, ")");
|
|
29
29
|
const abap_user_timezone = (0, combi_1.seq)("ABAP_USER_TIMEZONE", "(", input, ",", input, ",", input, ")");
|
|
30
|
-
return (0, combi_1.
|
|
30
|
+
return (0, combi_1.altPrio)(substring, coalesce, tstmp_to_dats, concat, tstmp_to_tims, concat_with_space, dats_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, abap_system_timezone, abap_user_timezone, bintohex, hextobin, dats_add_days, dats_add_months, tstmp_to_dst, dats_tims_to_tstmp);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.CDSFunction = CDSFunction;
|
package/build/src/config.js
CHANGED
|
@@ -6,30 +6,6 @@ const artifacts_rules_1 = require("./artifacts_rules");
|
|
|
6
6
|
const JSON5 = require("json5");
|
|
7
7
|
// assumption: this class is immutable
|
|
8
8
|
class Config {
|
|
9
|
-
constructor(json) {
|
|
10
|
-
// huh, hack
|
|
11
|
-
if (JSON5.parse === undefined) {
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
JSON5.parse = JSON5.default.parse;
|
|
14
|
-
}
|
|
15
|
-
this.config = JSON5.parse(json);
|
|
16
|
-
if (this.config.global === undefined) {
|
|
17
|
-
this.config.global = Config.getDefault().getGlobal();
|
|
18
|
-
}
|
|
19
|
-
if (this.config.syntax === undefined) {
|
|
20
|
-
this.config.syntax = Config.getDefault().getSyntaxSetttings();
|
|
21
|
-
}
|
|
22
|
-
if (this.config.syntax.globalMacros === undefined) {
|
|
23
|
-
this.config.syntax.globalMacros = [];
|
|
24
|
-
}
|
|
25
|
-
if (this.config.syntax.globalConstants === undefined) {
|
|
26
|
-
this.config.syntax.globalConstants = [];
|
|
27
|
-
}
|
|
28
|
-
if (this.config.global.skipIncludesWithoutMain === undefined) {
|
|
29
|
-
this.config.global.skipIncludesWithoutMain = false;
|
|
30
|
-
}
|
|
31
|
-
this.checkVersion();
|
|
32
|
-
}
|
|
33
9
|
static getDefault(ver) {
|
|
34
10
|
const rules = {};
|
|
35
11
|
const sorted = artifacts_rules_1.ArtifactsRules.getRules().sort((a, b) => {
|
|
@@ -93,6 +69,30 @@ class Config {
|
|
|
93
69
|
}
|
|
94
70
|
return rules;
|
|
95
71
|
}
|
|
72
|
+
constructor(json) {
|
|
73
|
+
// huh, hack
|
|
74
|
+
if (JSON5.parse === undefined) {
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
JSON5.parse = JSON5.default.parse;
|
|
77
|
+
}
|
|
78
|
+
this.config = JSON5.parse(json);
|
|
79
|
+
if (this.config.global === undefined) {
|
|
80
|
+
this.config.global = Config.getDefault().getGlobal();
|
|
81
|
+
}
|
|
82
|
+
if (this.config.syntax === undefined) {
|
|
83
|
+
this.config.syntax = Config.getDefault().getSyntaxSetttings();
|
|
84
|
+
}
|
|
85
|
+
if (this.config.syntax.globalMacros === undefined) {
|
|
86
|
+
this.config.syntax.globalMacros = [];
|
|
87
|
+
}
|
|
88
|
+
if (this.config.syntax.globalConstants === undefined) {
|
|
89
|
+
this.config.syntax.globalConstants = [];
|
|
90
|
+
}
|
|
91
|
+
if (this.config.global.skipIncludesWithoutMain === undefined) {
|
|
92
|
+
this.config.global.skipIncludesWithoutMain = false;
|
|
93
|
+
}
|
|
94
|
+
this.checkVersion();
|
|
95
|
+
}
|
|
96
96
|
get() {
|
|
97
97
|
return this.config;
|
|
98
98
|
}
|
package/build/src/issue.js
CHANGED
|
@@ -4,19 +4,6 @@ exports.Issue = void 0;
|
|
|
4
4
|
const position_1 = require("./position");
|
|
5
5
|
const severity_1 = require("./severity");
|
|
6
6
|
class Issue {
|
|
7
|
-
constructor(data) {
|
|
8
|
-
this.data = data;
|
|
9
|
-
if (this.data.start instanceof position_1.VirtualPosition) {
|
|
10
|
-
// no quick fixes inside macros
|
|
11
|
-
this.data.fix = undefined;
|
|
12
|
-
}
|
|
13
|
-
if (this.data.start.getCol() < 1) {
|
|
14
|
-
throw new Error("issue, start col < 1");
|
|
15
|
-
}
|
|
16
|
-
else if (this.data.end.getCol() < 1) {
|
|
17
|
-
throw new Error("issue, end col < 1");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
7
|
//////////////////////////
|
|
21
8
|
static atRow(file, row, message, key, severity) {
|
|
22
9
|
const start = new position_1.Position(row, 1);
|
|
@@ -98,6 +85,19 @@ class Issue {
|
|
|
98
85
|
fix,
|
|
99
86
|
});
|
|
100
87
|
}
|
|
88
|
+
constructor(data) {
|
|
89
|
+
this.data = data;
|
|
90
|
+
if (this.data.start instanceof position_1.VirtualPosition) {
|
|
91
|
+
// no quick fixes inside macros
|
|
92
|
+
this.data.fix = undefined;
|
|
93
|
+
}
|
|
94
|
+
if (this.data.start.getCol() < 1) {
|
|
95
|
+
throw new Error("issue, start col < 1");
|
|
96
|
+
}
|
|
97
|
+
else if (this.data.end.getCol() < 1) {
|
|
98
|
+
throw new Error("issue, end col < 1");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
101
|
getData() {
|
|
102
102
|
return this.data;
|
|
103
103
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -225,6 +225,8 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
225
225
|
ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));
|
|
226
226
|
*/
|
|
227
227
|
// hmm, add some way to disable lazyUnknown() in statement_parser.ts
|
|
228
|
+
// alternatively explicit enable it in vscode, its only relevant when a user is
|
|
229
|
+
// actively editing the files
|
|
228
230
|
continue;
|
|
229
231
|
}
|
|
230
232
|
for (let i = 0; i < lowStatements.length; i++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.93.
|
|
3
|
+
"version": "2.93.86",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"c8": "^7.12.0",
|
|
57
57
|
"source-map-support": "^0.5.21",
|
|
58
58
|
"ts-json-schema-generator": "^1.1.2",
|
|
59
|
-
"typescript": "^4.
|
|
59
|
+
"typescript": "^4.9.3"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"fast-xml-parser": "^4.0.11",
|