@abaplint/runtime 2.3.2 → 2.3.4
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/compare/cp.js +5 -1
- package/build/src/operators/_parse.js +6 -1
- package/build/src/operators/add.js +2 -1
- package/build/src/statements/collect.d.ts +3 -0
- package/build/src/statements/collect.js +14 -0
- package/build/src/statements/index.d.ts +2 -0
- package/build/src/statements/index.js +2 -0
- package/build/src/statements/write.js +3 -0
- package/build/src/types/packed.d.ts +1 -0
- package/build/src/types/packed.js +6 -2
- package/package.json +2 -2
package/build/src/compare/cp.js
CHANGED
|
@@ -19,14 +19,18 @@ function cp(left, right) {
|
|
|
19
19
|
r = r.replace(/\\/g, "\\\\");
|
|
20
20
|
r = r.replace(/\[/g, "\\[");
|
|
21
21
|
r = r.replace(/\]/g, "\\]");
|
|
22
|
+
r = r.replace(/\}/g, "\\}");
|
|
23
|
+
r = r.replace(/\{/g, "\\{");
|
|
22
24
|
r = r.replace(/\?/g, "\\?");
|
|
23
25
|
r = r.replace(/\(/g, "\\(");
|
|
24
26
|
r = r.replace(/\)/g, "\\)");
|
|
25
27
|
r = r.replace(/\./g, "\\.");
|
|
26
28
|
r = r.replace(/\|/g, "\\|");
|
|
29
|
+
r = r.replace(/#\*/g, "\\u{002A}");
|
|
30
|
+
r = r.replace(/#\+/g, "\\u{002B}");
|
|
27
31
|
r = r.replace(/\*/g, "[\\s\\S]*");
|
|
28
32
|
r = r.replace(/\+/g, "[\\s\\S]");
|
|
29
|
-
const reg = new RegExp("^" + r + "$", "
|
|
33
|
+
const reg = new RegExp("^" + r + "$", "iu");
|
|
30
34
|
return l.match(reg) !== null;
|
|
31
35
|
}
|
|
32
36
|
exports.cp = cp;
|
|
@@ -8,7 +8,12 @@ function parse(val) {
|
|
|
8
8
|
return val;
|
|
9
9
|
}
|
|
10
10
|
else if (typeof val === "string") {
|
|
11
|
-
|
|
11
|
+
if (val.includes(".")) {
|
|
12
|
+
return parseFloat(val);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return parseInt(val, 10);
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
18
|
else if (val instanceof types_1.Float) {
|
|
14
19
|
return val.getRaw();
|
|
@@ -24,7 +24,8 @@ function add(left, right) {
|
|
|
24
24
|
else if ((right instanceof string_1.String || right instanceof types_1.Character) && Number.isInteger(Number(right)) && left instanceof types_1.Integer) {
|
|
25
25
|
return new types_1.Integer().set(left.get() + Number.parseInt(right.get(), 10));
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const ret = new types_1.Float().set((0, _parse_1.parse)(left) + (0, _parse_1.parse)(right));
|
|
28
|
+
return ret;
|
|
28
29
|
}
|
|
29
30
|
exports.add = add;
|
|
30
31
|
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collect = void 0;
|
|
4
|
+
const compare_1 = require("../compare");
|
|
5
|
+
const insert_internal_1 = require("./insert_internal");
|
|
6
|
+
const read_table_1 = require("./read_table");
|
|
7
|
+
function collect(source, target) {
|
|
8
|
+
const read = (0, read_table_1.readTable)(target, { withKey: (i) => { return (0, compare_1.eq)(i.table_line, source); } });
|
|
9
|
+
if (read.subrc === 4) {
|
|
10
|
+
(0, insert_internal_1.insertInternal)({ table: target, data: source });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.collect = collect;
|
|
14
|
+
//# sourceMappingURL=collect.js.map
|
|
@@ -10,6 +10,7 @@ import { createData } from "./create_data";
|
|
|
10
10
|
import { deleteInternal } from "./delete_internal";
|
|
11
11
|
import { describe } from "./describe";
|
|
12
12
|
import { find } from "./find";
|
|
13
|
+
import { collect } from "./collect";
|
|
13
14
|
import { overlay } from "./overlay";
|
|
14
15
|
import { cast } from "./cast";
|
|
15
16
|
import { getBit } from "./get_bit";
|
|
@@ -49,6 +50,7 @@ export declare class Statements {
|
|
|
49
50
|
cast: typeof cast;
|
|
50
51
|
clear: typeof clear;
|
|
51
52
|
commit: typeof commit;
|
|
53
|
+
collect: typeof collect;
|
|
52
54
|
concatenate: typeof concatenate;
|
|
53
55
|
condense: typeof condense;
|
|
54
56
|
convert: typeof convert;
|
|
@@ -13,6 +13,7 @@ const create_data_1 = require("./create_data");
|
|
|
13
13
|
const delete_internal_1 = require("./delete_internal");
|
|
14
14
|
const describe_1 = require("./describe");
|
|
15
15
|
const find_1 = require("./find");
|
|
16
|
+
const collect_1 = require("./collect");
|
|
16
17
|
const overlay_1 = require("./overlay");
|
|
17
18
|
const cast_1 = require("./cast");
|
|
18
19
|
const get_bit_1 = require("./get_bit");
|
|
@@ -51,6 +52,7 @@ class Statements {
|
|
|
51
52
|
this.cast = cast_1.cast;
|
|
52
53
|
this.clear = clear_1.clear;
|
|
53
54
|
this.commit = commit_1.commit;
|
|
55
|
+
this.collect = collect_1.collect;
|
|
54
56
|
this.concatenate = concatenate_1.concatenate;
|
|
55
57
|
this.condense = condense_1.condense;
|
|
56
58
|
this.convert = convert_1.convert;
|
|
@@ -18,15 +18,19 @@ class Packed {
|
|
|
18
18
|
getQualifiedName() {
|
|
19
19
|
return this.qualifiedName;
|
|
20
20
|
}
|
|
21
|
+
round(value, places) {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
return +(Math.round(value + "e+" + places) + "e-" + places);
|
|
24
|
+
}
|
|
21
25
|
set(value) {
|
|
22
26
|
if (typeof value === "number") {
|
|
23
27
|
this.value = value;
|
|
24
28
|
}
|
|
25
29
|
else if (typeof value === "string") {
|
|
26
|
-
this.value = parseFloat(value);
|
|
30
|
+
this.value = this.round(parseFloat(value), this.decimals);
|
|
27
31
|
}
|
|
28
32
|
else if (value instanceof float_1.Float) {
|
|
29
|
-
this.value = value.getRaw();
|
|
33
|
+
this.value = this.round(value.getRaw(), this.decimals);
|
|
30
34
|
}
|
|
31
35
|
else {
|
|
32
36
|
this.set(value.get());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "Transpiler - Runtime",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/chai": "^4.3.3",
|
|
32
32
|
"@types/mocha": "^10.0.0",
|
|
33
33
|
"chai": "^4.3.6",
|
|
34
|
-
"mocha": "^10.
|
|
34
|
+
"mocha": "^10.1.0",
|
|
35
35
|
"source-map-support": "^0.5.21",
|
|
36
36
|
"typescript": "^4.8.4"
|
|
37
37
|
},
|