@abaplint/runtime 2.3.39 → 2.3.41

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.
@@ -5,7 +5,10 @@ class ABAPRegExp {
5
5
  // converts from ABAP specific regex to javascript regex
6
6
  static convert(input) {
7
7
  let ret = input;
8
- ret = input.replace(/\[\[:punct:\]\]/g, "[@%\\.\\,\\-\\{\\}\\[\\]\\:\\!\\?\\(\\)\\;\\']");
8
+ ret = ret.replace(/\[\[:punct:\]\]/g, "[@%\\.\\,\\-\\{\\}\\[\\]\\:\\!\\?\\(\\)\\;\\']");
9
+ // https://github.com/micromatch/posix-character-classes#posix-character-classes
10
+ ret = ret.replace(/\[\^\[:print:\]\]/g, "[\\x00-\\x1F\\x7F]");
11
+ ret = ret.replace("[[:space:]]", "\\s");
9
12
  return ret;
10
13
  }
11
14
  }
@@ -1,5 +1,5 @@
1
1
  import { INumeric } from "../types/_numeric";
2
- import { Integer } from "../types/integer";
2
+ import { Float } from "../types";
3
3
  export interface INmaxInput {
4
4
  val1: number | INumeric;
5
5
  val2: number | INumeric;
@@ -11,4 +11,4 @@ export interface INmaxInput {
11
11
  val8?: number | INumeric;
12
12
  val9?: number | INumeric;
13
13
  }
14
- export declare function nmax(input: INmaxInput): Integer;
14
+ export declare function nmax(input: INmaxInput): Float;
@@ -1,42 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nmax = void 0;
4
- const integer_1 = require("../types/integer");
4
+ const _parse_1 = require("../operators/_parse");
5
+ const types_1 = require("../types");
5
6
  function nmax(input) {
6
7
  const values = [];
7
- values.push(get_nmax_val_input(input.val1));
8
- values.push(get_nmax_val_input(input.val2));
8
+ values.push((0, _parse_1.parse)(input.val1));
9
+ values.push((0, _parse_1.parse)(input.val2));
9
10
  if (input.val3) {
10
- values.push(get_nmax_val_input(input.val3));
11
+ values.push((0, _parse_1.parse)(input.val3));
11
12
  }
12
13
  if (input.val4) {
13
- values.push(get_nmax_val_input(input.val4));
14
+ values.push((0, _parse_1.parse)(input.val4));
14
15
  }
15
16
  if (input.val5) {
16
- values.push(get_nmax_val_input(input.val5));
17
+ values.push((0, _parse_1.parse)(input.val5));
17
18
  }
18
19
  if (input.val6) {
19
- values.push(get_nmax_val_input(input.val6));
20
+ values.push((0, _parse_1.parse)(input.val6));
20
21
  }
21
22
  if (input.val7) {
22
- values.push(get_nmax_val_input(input.val7));
23
+ values.push((0, _parse_1.parse)(input.val7));
23
24
  }
24
25
  if (input.val8) {
25
- values.push(get_nmax_val_input(input.val8));
26
+ values.push((0, _parse_1.parse)(input.val8));
26
27
  }
27
28
  if (input.val9) {
28
- values.push(get_nmax_val_input(input.val9));
29
+ values.push((0, _parse_1.parse)(input.val9));
29
30
  }
30
31
  values.sort((a, b) => (b - a));
31
- return new integer_1.Integer().set(values[0]);
32
+ return new types_1.Float().set(values[0]);
32
33
  }
33
34
  exports.nmax = nmax;
34
- function get_nmax_val_input(val) {
35
- if (typeof val === "number") {
36
- return val;
37
- }
38
- else {
39
- return val.get();
40
- }
41
- }
42
35
  //# sourceMappingURL=nmax.js.map
@@ -1,5 +1,5 @@
1
1
  import { INumeric } from "../types/_numeric";
2
- import { Integer } from "../types/integer";
2
+ import { Float } from "../types";
3
3
  export interface INminInput {
4
4
  val1: number | INumeric;
5
5
  val2: number | INumeric;
@@ -11,4 +11,4 @@ export interface INminInput {
11
11
  val8?: number | INumeric;
12
12
  val9?: number | INumeric;
13
13
  }
14
- export declare function nmin(input: INminInput): Integer;
14
+ export declare function nmin(input: INminInput): Float;
@@ -1,42 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nmin = void 0;
4
- const integer_1 = require("../types/integer");
4
+ const _parse_1 = require("../operators/_parse");
5
+ const types_1 = require("../types");
5
6
  function nmin(input) {
6
7
  const values = [];
7
- values.push(get_nmin_val_input(input.val1));
8
- values.push(get_nmin_val_input(input.val2));
8
+ values.push((0, _parse_1.parse)(input.val1));
9
+ values.push((0, _parse_1.parse)(input.val2));
9
10
  if (input.val3) {
10
- values.push(get_nmin_val_input(input.val3));
11
+ values.push((0, _parse_1.parse)(input.val3));
11
12
  }
12
13
  if (input.val4) {
13
- values.push(get_nmin_val_input(input.val4));
14
+ values.push((0, _parse_1.parse)(input.val4));
14
15
  }
15
16
  if (input.val5) {
16
- values.push(get_nmin_val_input(input.val5));
17
+ values.push((0, _parse_1.parse)(input.val5));
17
18
  }
18
19
  if (input.val6) {
19
- values.push(get_nmin_val_input(input.val6));
20
+ values.push((0, _parse_1.parse)(input.val6));
20
21
  }
21
22
  if (input.val7) {
22
- values.push(get_nmin_val_input(input.val7));
23
+ values.push((0, _parse_1.parse)(input.val7));
23
24
  }
24
25
  if (input.val8) {
25
- values.push(get_nmin_val_input(input.val8));
26
+ values.push((0, _parse_1.parse)(input.val8));
26
27
  }
27
28
  if (input.val9) {
28
- values.push(get_nmin_val_input(input.val9));
29
+ values.push((0, _parse_1.parse)(input.val9));
29
30
  }
30
31
  values.sort((a, b) => (a - b));
31
- return new integer_1.Integer().set(values[0]);
32
+ return new types_1.Float().set(values[0]);
32
33
  }
33
34
  exports.nmin = nmin;
34
- function get_nmin_val_input(val) {
35
- if (typeof val === "number") {
36
- return val;
37
- }
38
- else {
39
- return val.get();
40
- }
41
- }
42
35
  //# sourceMappingURL=nmin.js.map
@@ -1,10 +1,10 @@
1
- import { Structure, Table } from "../types";
1
+ import { ABAPObject, Structure, Table } from "../types";
2
2
  import { ICharacter } from "../types/_character";
3
3
  import { INumeric } from "../types/_numeric";
4
4
  export interface IFindOptions {
5
5
  find?: ICharacter | string;
6
6
  first?: boolean;
7
- regex?: string | ICharacter;
7
+ regex?: string | ICharacter | ABAPObject;
8
8
  offset?: INumeric;
9
9
  sectionOffset?: INumeric;
10
10
  byteMode?: boolean;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.find = void 0;
4
+ const abap_regex_1 = require("../abap_regex");
4
5
  const types_1 = require("../types");
5
6
  function find(input, options) {
6
7
  var _a, _b, _c, _d, _e, _f, _g;
@@ -38,11 +39,22 @@ function find(input, options) {
38
39
  if (typeof r !== "string") {
39
40
  r = r.get();
40
41
  }
41
- // check type, it can also be a CL_ABAP_REGEX
42
42
  if (typeof r === "string") {
43
- r = r.replace("[[:space:]]", "\\s");
43
+ r = abap_regex_1.ABAPRegExp.convert(r);
44
44
  }
45
- s = new RegExp(r, "g" + (options.ignoringCase === true ? "i" : ""));
45
+ else if (r.constructor.name === "cl_abap_regex") {
46
+ const obj = r;
47
+ // @ts-ignore
48
+ r = obj.mv_pattern.get();
49
+ // @ts-ignore
50
+ if (obj.mv_ignore_case.get() === "X") {
51
+ options.ignoringCase = true;
52
+ }
53
+ }
54
+ else {
55
+ throw "find(), unexpected input";
56
+ }
57
+ s = new RegExp(r, "gm" + (options.ignoringCase === true ? "i" : ""));
46
58
  }
47
59
  else {
48
60
  throw "FIND, runtime, no input";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.3.39",
3
+ "version": "2.3.41",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -28,9 +28,9 @@
28
28
  "author": "abaplint",
29
29
  "license": "MIT",
30
30
  "devDependencies": {
31
- "@types/chai": "^4.3.3",
31
+ "@types/chai": "^4.3.4",
32
32
  "@types/mocha": "^10.0.0",
33
- "chai": "^4.3.6",
33
+ "chai": "^4.3.7",
34
34
  "mocha": "^10.1.0",
35
35
  "source-map-support": "^0.5.21",
36
36
  "typescript": "^4.8.4"