@abaplint/runtime 2.0.15 → 2.0.18

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,3 @@
1
+ export declare class ABAPRegExp {
2
+ static convert(input: string): string;
3
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ABAPRegExp = void 0;
4
+ class ABAPRegExp {
5
+ // converts from ABAP specific regex to javascript regex
6
+ static convert(input) {
7
+ let ret = input;
8
+ ret = input.replace(/\[\[:punct:\]\]/g, "[\\.\\,]");
9
+ return ret;
10
+ }
11
+ }
12
+ exports.ABAPRegExp = ABAPRegExp;
13
+ //# sourceMappingURL=abap_regex.js.map
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.replace = void 0;
4
4
  const string_1 = require("../types/string");
5
+ const abap_regex_1 = require("../abap_regex");
6
+ const types_1 = require("../types");
5
7
  function replace(input) {
6
8
  let val = undefined;
7
9
  if (typeof input.val === "string") {
@@ -14,6 +16,9 @@ function replace(input) {
14
16
  if (typeof input.with === "string") {
15
17
  wi = input.with;
16
18
  }
19
+ else if (input.with instanceof types_1.Character) {
20
+ wi = input.with.get().trimEnd();
21
+ }
17
22
  else if (input.with) {
18
23
  wi = input.with.get();
19
24
  }
@@ -29,10 +34,10 @@ function replace(input) {
29
34
  sub = sub.replace(/\[/g, "\\[");
30
35
  }
31
36
  if (typeof input.regex === "string") {
32
- sub = input.regex;
37
+ sub = new RegExp(abap_regex_1.ABAPRegExp.convert(input.regex), "g");
33
38
  }
34
39
  else if (input.regex) {
35
- sub = input.regex.get();
40
+ sub = new RegExp(abap_regex_1.ABAPRegExp.convert(input.regex.get()), "g");
36
41
  }
37
42
  if (input.off && input.len && typeof input.val === "string") {
38
43
  const offset = input.off.get();
@@ -50,8 +55,10 @@ function replace(input) {
50
55
  val = val.replace(sub, wi);
51
56
  }
52
57
  else if (input.occ && input.occ.get() === 0 && sub && wi !== undefined) {
53
- const reg = new RegExp(sub, "g");
54
- val = val.replace(reg, wi);
58
+ if (typeof sub === "string") {
59
+ sub = new RegExp(sub, "g");
60
+ }
61
+ val = val.replace(sub, wi);
55
62
  }
56
63
  return new string_1.String().set(val);
57
64
  }
@@ -6,5 +6,6 @@ export declare type replaceInput = {
6
6
  all: boolean;
7
7
  with: ICharacter;
8
8
  of: ICharacter;
9
+ ignoringCase?: boolean;
9
10
  };
10
11
  export declare function replace(input: replaceInput): void;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.replace = void 0;
4
4
  function replace(input) {
5
5
  let temp = input.target.get();
6
+ const ignoreCase = input.ignoringCase === true ? "i" : "";
6
7
  let search = "";
7
8
  let found = false;
8
9
  if (input.of) {
@@ -11,13 +12,16 @@ function replace(input) {
11
12
  throw "REPLACE, zero length input";
12
13
  }
13
14
  found = temp.indexOf(search) >= 0;
15
+ if (ignoreCase.length > 0) {
16
+ search = new RegExp(search, ignoreCase);
17
+ }
14
18
  }
15
19
  else if (input.regex) {
16
20
  if (input.regex.get().length === 0 && input.all === true) {
17
21
  throw "REPLACE, zero length input";
18
22
  }
19
23
  found = temp.match(search) !== null;
20
- search = new RegExp(input.regex.get());
24
+ search = new RegExp(input.regex.get(), ignoreCase);
21
25
  }
22
26
  let replace = "";
23
27
  if (typeof input.with === "string") {
@@ -28,7 +32,7 @@ function replace(input) {
28
32
  }
29
33
  if (input.all === true) {
30
34
  if (input.regex) {
31
- temp = temp.replace(new RegExp(input.regex.get(), "g"), replace);
35
+ temp = temp.replace(new RegExp(input.regex.get(), "g" + ignoreCase), replace);
32
36
  }
33
37
  else {
34
38
  while (temp.replace(search, replace) !== temp) {
@@ -13,4 +13,5 @@ export * from "./string";
13
13
  export * from "./structure";
14
14
  export * from "./table";
15
15
  export * from "./time";
16
+ export * from "./utc_long";
16
17
  export * from "./xstring";
@@ -29,5 +29,6 @@ __exportStar(require("./string"), exports);
29
29
  __exportStar(require("./structure"), exports);
30
30
  __exportStar(require("./table"), exports);
31
31
  __exportStar(require("./time"), exports);
32
+ __exportStar(require("./utc_long"), exports);
32
33
  __exportStar(require("./xstring"), exports);
33
34
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ import { Hex } from "./hex";
2
+ import { ICharacter } from "./_character";
3
+ import { INumeric } from "./_numeric";
4
+ export declare class UTCLong implements ICharacter {
5
+ private value;
6
+ constructor();
7
+ getOffset(_input: {
8
+ offset?: number | undefined;
9
+ length?: number | undefined;
10
+ }): ICharacter;
11
+ set(_value: INumeric | ICharacter | Hex | string | number): this;
12
+ clear(): void;
13
+ get(): string;
14
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UTCLong = void 0;
4
+ class UTCLong {
5
+ constructor() {
6
+ this.clear();
7
+ }
8
+ getOffset(_input) {
9
+ throw new Error("Method not implemented.");
10
+ }
11
+ set(_value) {
12
+ // todo
13
+ return this;
14
+ }
15
+ clear() {
16
+ this.value = "";
17
+ }
18
+ get() {
19
+ return this.value;
20
+ }
21
+ }
22
+ exports.UTCLong = UTCLong;
23
+ //# sourceMappingURL=utc_long.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.0.15",
3
+ "version": "2.0.18",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "@types/mocha": "^9.1.1",
33
33
  "@types/sql.js": "^1.4.3",
34
34
  "chai": "^4.3.6",
35
- "mocha": "^9.2.2",
35
+ "mocha": "^10.0.0",
36
36
  "source-map-support": "^0.5.21",
37
37
  "typescript": "^4.6.4"
38
38
  }