@abaplint/runtime 2.0.11 → 2.0.14
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/builtin/boolc.d.ts +4 -2
- package/build/src/builtin/boolc.js +4 -1
- package/build/src/builtin/index.d.ts +2 -0
- package/build/src/builtin/index.js +2 -0
- package/build/src/builtin/match.d.ts +5 -0
- package/build/src/builtin/match.js +23 -0
- package/build/src/builtin/matches.d.ts +5 -0
- package/build/src/builtin/matches.js +24 -0
- package/build/src/builtin/substring_after.d.ts +2 -1
- package/build/src/builtin/substring_after.js +14 -2
- package/build/src/builtin/sy.js +2 -1
- package/build/src/statements/cast.js +14 -10
- package/package.json +1 -1
|
@@ -7,7 +7,10 @@ function boolc(input) {
|
|
|
7
7
|
return new types_1.String().set("X");
|
|
8
8
|
}
|
|
9
9
|
else if (input === false || input === undefined) {
|
|
10
|
-
return new types_1.String().set("");
|
|
10
|
+
return new types_1.String().set(" ");
|
|
11
|
+
}
|
|
12
|
+
else if (input.val instanceof types_1.Character && input.val.get().trim() === "") {
|
|
13
|
+
return new types_1.String().set(" ");
|
|
11
14
|
}
|
|
12
15
|
else {
|
|
13
16
|
return new types_1.String().set("X");
|
|
@@ -28,6 +28,8 @@ __exportStar(require("./find"), exports);
|
|
|
28
28
|
__exportStar(require("./floor"), exports);
|
|
29
29
|
__exportStar(require("./frac"), exports);
|
|
30
30
|
__exportStar(require("./insert"), exports);
|
|
31
|
+
__exportStar(require("./match"), exports);
|
|
32
|
+
__exportStar(require("./matches"), exports);
|
|
31
33
|
__exportStar(require("./lines"), exports);
|
|
32
34
|
__exportStar(require("./nmax"), exports);
|
|
33
35
|
__exportStar(require("./nmin"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.match = void 0;
|
|
4
|
+
const string_1 = require("../types/string");
|
|
5
|
+
function match(input) {
|
|
6
|
+
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
7
|
+
let reg = "";
|
|
8
|
+
if (typeof input.regex === "string") {
|
|
9
|
+
reg = input.regex;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
reg = input.regex.get();
|
|
13
|
+
}
|
|
14
|
+
const r = new RegExp(reg);
|
|
15
|
+
const res = val.match(r);
|
|
16
|
+
let ret = "";
|
|
17
|
+
if (res && res[0]) {
|
|
18
|
+
ret = res[0];
|
|
19
|
+
}
|
|
20
|
+
return new string_1.String().set(ret);
|
|
21
|
+
}
|
|
22
|
+
exports.match = match;
|
|
23
|
+
//# sourceMappingURL=match.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matches = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
function matches(input) {
|
|
6
|
+
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
7
|
+
let reg = "";
|
|
8
|
+
if (typeof input.regex === "string") {
|
|
9
|
+
reg = input.regex;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
reg = input.regex.get();
|
|
13
|
+
}
|
|
14
|
+
const r = new RegExp("^" + reg + "$");
|
|
15
|
+
const res = val.match(r);
|
|
16
|
+
if (res !== null) {
|
|
17
|
+
return new types_1.Character().set("X");
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return new types_1.Character().set(" ");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.matches = matches;
|
|
24
|
+
//# sourceMappingURL=matches.js.map
|
|
@@ -4,8 +4,20 @@ exports.substring_after = void 0;
|
|
|
4
4
|
const string_1 = require("../types/string");
|
|
5
5
|
function substring_after(input) {
|
|
6
6
|
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
let reg = "";
|
|
8
|
+
if (typeof input.regex === "string") {
|
|
9
|
+
reg = input.regex;
|
|
10
|
+
}
|
|
11
|
+
else if (input === null || input === void 0 ? void 0 : input.regex) {
|
|
12
|
+
reg = input.regex.get();
|
|
13
|
+
}
|
|
14
|
+
else if (typeof input.sub === "string") {
|
|
15
|
+
reg = input.sub;
|
|
16
|
+
}
|
|
17
|
+
else if (input === null || input === void 0 ? void 0 : input.sub) {
|
|
18
|
+
reg = input.sub.get();
|
|
19
|
+
}
|
|
20
|
+
const r = new RegExp(reg + "(.*)");
|
|
9
21
|
const res = val.match(r);
|
|
10
22
|
let ret = "";
|
|
11
23
|
if (res && res[1]) {
|
package/build/src/builtin/sy.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.sy = new types_1.Structure({
|
|
|
13
13
|
mandt: new types_1.Character({ length: 3 }).set("123"),
|
|
14
14
|
msgid: new types_1.Character({ length: 20 }),
|
|
15
15
|
msgno: new types_1.Numc({ length: 3 }),
|
|
16
|
+
msgty: new types_1.Character({ length: 1 }),
|
|
16
17
|
msgv1: new types_1.Character({ length: 50 }),
|
|
17
18
|
msgv2: new types_1.Character({ length: 50 }),
|
|
18
19
|
msgv3: new types_1.Character({ length: 50 }),
|
|
@@ -20,8 +21,8 @@ exports.sy = new types_1.Structure({
|
|
|
20
21
|
subrc: new types_1.Integer(),
|
|
21
22
|
sysid: new types_1.Character({ length: 3 }).set("ABC"),
|
|
22
23
|
tabix: new types_1.Integer(),
|
|
23
|
-
tzone: new types_1.Integer(),
|
|
24
24
|
timlo: new types_1.Time(),
|
|
25
|
+
tzone: new types_1.Integer(),
|
|
25
26
|
uname: new types_1.Character({ length: 12 }).set("USERNAME"),
|
|
26
27
|
uzeit: new types_1.Time(),
|
|
27
28
|
});
|
|
@@ -9,20 +9,24 @@ async function cast(target, source) {
|
|
|
9
9
|
target.clear();
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
/*
|
|
13
|
+
const targetName = target.getQualifiedName()?.toUpperCase();
|
|
14
|
+
if (targetName?.startsWith("IF_") === false
|
|
15
|
+
&& targetName?.startsWith("ZIF_") === false) { // todo, interfaces are also classes but not inherited
|
|
16
|
+
// using "instanceof" is probably wrong in some cases,
|
|
17
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
if (abap.Classes[targetName] && source instanceof abap.Classes[targetName] === false) {
|
|
17
20
|
// @ts-ignore
|
|
18
21
|
if (abap.Classes["CX_SY_MOVE_CAST_ERROR"] !== undefined) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
throw "Global class CX_SY_MOVE_CAST_ERROR not found";
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
throw new abap.Classes["CX_SY_MOVE_CAST_ERROR"]();
|
|
24
|
+
} else {
|
|
25
|
+
throw "Global class CX_SY_MOVE_CAST_ERROR not found";
|
|
24
26
|
}
|
|
27
|
+
}
|
|
25
28
|
}
|
|
29
|
+
*/
|
|
26
30
|
// throw cx_sy_move_cast_error if incompatible
|
|
27
31
|
// check with javascript instanceof?
|
|
28
32
|
// handling interfaces?
|