@abaplint/runtime 2.13.48 → 2.13.50

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.
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function acos(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.acos = acos;
4
+ const types_1 = require("../types");
5
+ function acos(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.acos(num_in);
20
+ }
21
+ //# sourceMappingURL=acos.js.map
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function asin(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asin = asin;
4
+ const types_1 = require("../types");
5
+ function asin(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.asin(num_in);
20
+ }
21
+ //# sourceMappingURL=asin.js.map
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function atan(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.atan = atan;
4
+ const types_1 = require("../types");
5
+ function atan(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.atan(num_in);
20
+ }
21
+ //# sourceMappingURL=atan.js.map
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function cosh(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cosh = cosh;
4
+ const types_1 = require("../types");
5
+ function cosh(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.cosh(num_in);
20
+ }
21
+ //# sourceMappingURL=cosh.js.map
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function exp(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exp = exp;
4
+ const types_1 = require("../types");
5
+ function exp(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.exp(num_in);
20
+ }
21
+ //# sourceMappingURL=exp.js.map
@@ -1,14 +1,19 @@
1
1
  import { Character } from "../types";
2
2
  export * from "./abs";
3
+ export * from "./acos";
4
+ export * from "./asin";
5
+ export * from "./atan";
3
6
  export * from "./boolc";
4
7
  export * from "./ceil";
5
8
  export * from "./concat_lines_of";
6
9
  export * from "./condense";
7
10
  export * from "./contains";
8
11
  export * from "./cos";
12
+ export * from "./cosh";
9
13
  export * from "./count_any_of";
10
14
  export * from "./count";
11
15
  export * from "./escape";
16
+ export * from "./exp";
12
17
  export * from "./find";
13
18
  export * from "./floor";
14
19
  export * from "./frac";
@@ -18,6 +23,8 @@ export * from "./ipow";
18
23
  export * from "./line_exists";
19
24
  export * from "./line_index";
20
25
  export * from "./lines";
26
+ export * from "./log";
27
+ export * from "./log10";
21
28
  export * from "./match";
22
29
  export * from "./matches";
23
30
  export * from "./nmax";
@@ -32,6 +39,7 @@ export * from "./shift_left";
32
39
  export * from "./shift_right";
33
40
  export * from "./sign";
34
41
  export * from "./sin";
42
+ export * from "./sinh";
35
43
  export * from "./sqrt";
36
44
  export * from "./strlen";
37
45
  export * from "./substring_after";
@@ -39,6 +47,7 @@ export * from "./substring_before";
39
47
  export * from "./substring";
40
48
  export * from "./sy";
41
49
  export * from "./tan";
50
+ export * from "./tanh";
42
51
  export * from "./to_lower";
43
52
  export * from "./to_mixed";
44
53
  export * from "./to_upper";
@@ -17,15 +17,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.$_vertical_tab = exports.$_newline = exports.$_horizontal_tab = exports.$_formfeed = exports.$_cr_lf = exports.$_backspace = exports.space = exports.abap_undefined = exports.abap_false = exports.abap_true = void 0;
18
18
  const types_1 = require("../types");
19
19
  __exportStar(require("./abs"), exports);
20
+ __exportStar(require("./acos"), exports);
21
+ __exportStar(require("./asin"), exports);
22
+ __exportStar(require("./atan"), exports);
20
23
  __exportStar(require("./boolc"), exports);
21
24
  __exportStar(require("./ceil"), exports);
22
25
  __exportStar(require("./concat_lines_of"), exports);
23
26
  __exportStar(require("./condense"), exports);
24
27
  __exportStar(require("./contains"), exports);
25
28
  __exportStar(require("./cos"), exports);
29
+ __exportStar(require("./cosh"), exports);
26
30
  __exportStar(require("./count_any_of"), exports);
27
31
  __exportStar(require("./count"), exports);
28
32
  __exportStar(require("./escape"), exports);
33
+ __exportStar(require("./exp"), exports);
29
34
  __exportStar(require("./find"), exports);
30
35
  __exportStar(require("./floor"), exports);
31
36
  __exportStar(require("./frac"), exports);
@@ -35,6 +40,8 @@ __exportStar(require("./ipow"), exports);
35
40
  __exportStar(require("./line_exists"), exports);
36
41
  __exportStar(require("./line_index"), exports);
37
42
  __exportStar(require("./lines"), exports);
43
+ __exportStar(require("./log"), exports);
44
+ __exportStar(require("./log10"), exports);
38
45
  __exportStar(require("./match"), exports);
39
46
  __exportStar(require("./matches"), exports);
40
47
  __exportStar(require("./nmax"), exports);
@@ -49,6 +56,7 @@ __exportStar(require("./shift_left"), exports);
49
56
  __exportStar(require("./shift_right"), exports);
50
57
  __exportStar(require("./sign"), exports);
51
58
  __exportStar(require("./sin"), exports);
59
+ __exportStar(require("./sinh"), exports);
52
60
  __exportStar(require("./sqrt"), exports);
53
61
  __exportStar(require("./strlen"), exports);
54
62
  __exportStar(require("./substring_after"), exports);
@@ -56,6 +64,7 @@ __exportStar(require("./substring_before"), exports);
56
64
  __exportStar(require("./substring"), exports);
57
65
  __exportStar(require("./sy"), exports);
58
66
  __exportStar(require("./tan"), exports);
67
+ __exportStar(require("./tanh"), exports);
59
68
  __exportStar(require("./to_lower"), exports);
60
69
  __exportStar(require("./to_mixed"), exports);
61
70
  __exportStar(require("./to_upper"), exports);
@@ -76,5 +85,5 @@ exports.$_vertical_tab = new types_1.Character(1).set("\v").setConstant();
76
85
  /*
77
86
  export const $_maxchar = new Character(1).set(Buffer.from("FDFF", "hex").toString()).setConstant();
78
87
  export const $_minchar = new Character(1).set(Buffer.from("0000", "hex").toString()).setConstant();
79
- */
88
+ */
80
89
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function log(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.log = log;
4
+ const types_1 = require("../types");
5
+ function log(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.log(num_in);
20
+ }
21
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function log10(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.log10 = log10;
4
+ const types_1 = require("../types");
5
+ function log10(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.log10(num_in);
20
+ }
21
+ //# sourceMappingURL=log10.js.map
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function sinh(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sinh = sinh;
4
+ const types_1 = require("../types");
5
+ function sinh(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.sinh(num_in);
20
+ }
21
+ //# sourceMappingURL=sinh.js.map
@@ -0,0 +1,5 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function tanh(input: {
4
+ val: number | string | ICharacter | INumeric;
5
+ }): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tanh = tanh;
4
+ const types_1 = require("../types");
5
+ function tanh(input) {
6
+ let num_in = undefined;
7
+ if (typeof input.val === "number") {
8
+ num_in = input.val;
9
+ }
10
+ else if (typeof input.val === "string") {
11
+ num_in = parseFloat(input.val);
12
+ }
13
+ else if (input.val instanceof types_1.Float) {
14
+ num_in = input.val.getRaw();
15
+ }
16
+ else {
17
+ num_in = parseFloat(input.val.get().toString());
18
+ }
19
+ return Math.tanh(num_in);
20
+ }
21
+ //# sourceMappingURL=tanh.js.map
@@ -1,4 +1,4 @@
1
- import { ABAPObject, FieldSymbol, Float, HashedTable, String, Hex, Structure, Table, Integer8 } from "../types";
1
+ import { ABAPObject, DecFloat34, FieldSymbol, Float, HashedTable, String, Hex, Structure, Table, Integer8 } from "../types";
2
2
  import { ICharacter } from "../types/_character";
3
3
  import { INumeric } from "../types/_numeric";
4
- export declare function eq(left: number | string | ICharacter | Integer8 | INumeric | Float | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol, right: number | string | ICharacter | Integer8 | INumeric | Float | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol): boolean;
4
+ export declare function eq(left: number | string | ICharacter | Integer8 | INumeric | Float | DecFloat34 | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol, right: number | string | ICharacter | Integer8 | INumeric | Float | DecFloat34 | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol): boolean;
@@ -45,6 +45,7 @@ const DateC = types_1.Date;
45
45
  const TimeC = types_1.Time;
46
46
  const PackedC = types_1.Packed;
47
47
  const FloatC = types_1.Float;
48
+ const DecFloat34C = types_1.DecFloat34;
48
49
  const TableC = types_1.Table;
49
50
  const HashedTableC = types_1.HashedTable;
50
51
  const StructureC = types_1.Structure;
@@ -92,6 +93,9 @@ function eq(left, right) {
92
93
  else if (leftConstructor === FloatC) {
93
94
  return left.getRaw() === right.getRaw();
94
95
  }
96
+ else if (leftConstructor === DecFloat34C) {
97
+ return left.getRaw() === right.getRaw();
98
+ }
95
99
  else if (leftConstructor === TableC || leftConstructor === HashedTableC) {
96
100
  return compareTables(left, right);
97
101
  }
@@ -252,6 +256,9 @@ function eq(left, right) {
252
256
  else if (left instanceof types_1.Integer) {
253
257
  return right.get() === left.get();
254
258
  }
259
+ else if (left instanceof types_1.DecFloat34) {
260
+ return right.get() === left.getRaw();
261
+ }
255
262
  }
256
263
  else if (right instanceof types_1.Integer8) {
257
264
  if (left instanceof types_1.Integer
@@ -272,6 +279,14 @@ function eq(left, right) {
272
279
  return right.getRaw() === left.get();
273
280
  }
274
281
  }
282
+ else if (right instanceof types_1.DecFloat34) {
283
+ if (left instanceof types_1.Float || left instanceof types_1.DecFloat34) {
284
+ return right.getRaw() === left.getRaw();
285
+ }
286
+ else if (left instanceof types_1.Integer || left instanceof types_1.Packed) {
287
+ return right.getRaw() === left.get();
288
+ }
289
+ }
275
290
  if (left instanceof types_1.Structure || right instanceof types_1.Structure) {
276
291
  if (!(right instanceof types_1.Structure)) {
277
292
  return eq(left.getCharacter(), right);
@@ -17,19 +17,22 @@ function concatenate(input) {
17
17
  }
18
18
  }
19
19
  if (input.lines === true) {
20
- const list = [];
20
+ let result = "";
21
21
  const tab = input.source[0];
22
22
  if (tab instanceof types_1.Table) {
23
- for (const l of tab.array()) {
24
- if (input.respectingBlanks !== true) {
25
- list.push(l.get().trimEnd());
26
- }
27
- else {
28
- list.push(l.get());
23
+ const array = tab.array();
24
+ const length = array.length;
25
+ const respectingBlanks = input.respectingBlanks === true;
26
+ const hasSeparator = sep.length > 0;
27
+ for (let i = 0; i < length; i++) {
28
+ if (hasSeparator === true && i > 0) {
29
+ result += sep;
29
30
  }
31
+ const value = array[i].get();
32
+ result += respectingBlanks === true ? value : value.trimEnd();
30
33
  }
31
34
  }
32
- input.target.set(list.join(sep));
35
+ input.target.set(result);
33
36
  }
34
37
  else {
35
38
  let result = "";
@@ -97,6 +97,19 @@ function insertInternal(options) {
97
97
  }
98
98
  }
99
99
  else if (options.initial === true) {
100
+ if (options.table instanceof types_1.HashedTable) {
101
+ const { value: val, subrc: subrc } = options.table.insert(options.table.getRowType());
102
+ if (subrc === 0) {
103
+ if (options.assigning) {
104
+ options.assigning.assign(val);
105
+ }
106
+ if (options.referenceInto) {
107
+ options.referenceInto.assign(val);
108
+ }
109
+ }
110
+ abap.builtin.sy.get().subrc.set(subrc);
111
+ return;
112
+ }
100
113
  let index = options.table.getArrayLength();
101
114
  if (options.index) {
102
115
  index = options.index.get() - 1;
@@ -31,10 +31,10 @@ function dynamicToWhere(condition, evaluate) {
31
31
  if (evaluate === undefined) {
32
32
  throw new Error("Dynamic WHERE evaluation function is not defined");
33
33
  }
34
- const matches = text.matchAll(/([\w-]+)\s+(\w+)\s+([<>\w-]+)/gi);
34
+ const matches = text.matchAll(/([\w-]+)\s+(NOT\s+IN|\w+)\s+([<>\w-]+)/gi);
35
35
  for (const match of matches) {
36
36
  const left = match[1];
37
- const comparator = match[2].toLowerCase();
37
+ const comparator = match[2].toLowerCase().replace(/\s+/g, " ");
38
38
  let right = "";
39
39
  // console.dir({left, right});
40
40
  const cleft = "i." + left.toLowerCase().replace(/-/g, ".get().");
@@ -43,13 +43,21 @@ function dynamicToWhere(condition, evaluate) {
43
43
  const name = "fs_" + rightMatch[1].toLowerCase() + "_";
44
44
  right = `evaluate("${name}").get()["${rightMatch[2].toLowerCase()}"]`;
45
45
  }
46
+ const fieldSymbol = match[3].match(/^<(\w+)>$/);
47
+ if (right === "" && fieldSymbol) {
48
+ right = `evaluate("fs_${fieldSymbol[1].toLowerCase()}_").getPointer()`;
49
+ }
46
50
  if (right === "") {
47
- right = `evaluate("${match[3]}")`;
51
+ right = `evaluate("${match[3].toLowerCase()}")`;
48
52
  }
49
53
  if (comparator === "in") {
50
54
  const cnew = `abap.compare.in(${cleft}, ${right})`;
51
55
  text = text.replace(match[0], cnew);
52
56
  }
57
+ else if (comparator === "not in") {
58
+ const cnew = `!abap.compare.in(${cleft}, ${right})`;
59
+ text = text.replace(match[0], cnew);
60
+ }
53
61
  else {
54
62
  const cnew = `abap.compare.${comparator}(${cleft}, ${right})`;
55
63
  text = text.replace(match[0], cnew);
@@ -85,11 +85,11 @@ class Integer {
85
85
  this.set(Math.round(value.getRaw()));
86
86
  }
87
87
  else if (value instanceof hex_1.Hex || value instanceof xstring_1.XString || value instanceof hex_uint8_1.HexUInt8) {
88
- let num = parseInt(value.get(), 16);
89
- // handle two complement,
90
- if ((value instanceof hex_1.Hex || value instanceof hex_uint8_1.HexUInt8)
91
- && value.getLength() >= 4) {
92
- const maxVal = Math.pow(2, value.get().length / 2 * 8);
88
+ const hex = value.get();
89
+ let num = parseInt(hex, 16);
90
+ // handle two complement, the first bit is the sign
91
+ if (hex.length >= 8) {
92
+ const maxVal = Math.pow(2, hex.length / 2 * 8);
93
93
  if (num > maxVal / 2 - 1) {
94
94
  num = num - maxVal;
95
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.13.48",
3
+ "version": "2.13.50",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",