@abaplint/runtime 2.0.15 → 2.0.16

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/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @abaplint/runtime
2
-
1
+ # @abaplint/runtime
2
+
3
3
  Runtime
@@ -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
  }
@@ -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,39 +1,39 @@
1
- {
2
- "name": "@abaplint/runtime",
3
- "version": "2.0.15",
4
- "description": "Transpiler - Runtime",
5
- "main": "build/src/index.js",
6
- "typings": "build/src/index.d.ts",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/abaplint/transpiler.git"
10
- },
11
- "scripts": {
12
- "compile": "tsc",
13
- "publish:major": "npm --no-git-tag-version version major && rm -rf build && npm install && npm run test && npm publish --access public",
14
- "publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
15
- "publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
16
- "test": "npm run compile && mocha"
17
- },
18
- "mocha": {
19
- "recursive": true,
20
- "reporter": "progress",
21
- "spec": "build/test/**/*.js",
22
- "require": "source-map-support/register"
23
- },
24
- "keywords": [
25
- "ABAP",
26
- "abaplint"
27
- ],
28
- "author": "abaplint",
29
- "license": "MIT",
30
- "devDependencies": {
31
- "@types/chai": "^4.3.1",
32
- "@types/mocha": "^9.1.1",
33
- "@types/sql.js": "^1.4.3",
34
- "chai": "^4.3.6",
35
- "mocha": "^9.2.2",
36
- "source-map-support": "^0.5.21",
37
- "typescript": "^4.6.4"
38
- }
39
- }
1
+ {
2
+ "name": "@abaplint/runtime",
3
+ "version": "2.0.16",
4
+ "description": "Transpiler - Runtime",
5
+ "main": "build/src/index.js",
6
+ "typings": "build/src/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/abaplint/transpiler.git"
10
+ },
11
+ "scripts": {
12
+ "compile": "tsc",
13
+ "publish:major": "npm --no-git-tag-version version major && rm -rf build && npm install && npm run test && npm publish --access public",
14
+ "publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
15
+ "publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
16
+ "test": "npm run compile && mocha"
17
+ },
18
+ "mocha": {
19
+ "recursive": true,
20
+ "reporter": "progress",
21
+ "spec": "build/test/**/*.js",
22
+ "require": "source-map-support/register"
23
+ },
24
+ "keywords": [
25
+ "ABAP",
26
+ "abaplint"
27
+ ],
28
+ "author": "abaplint",
29
+ "license": "MIT",
30
+ "devDependencies": {
31
+ "@types/chai": "^4.3.1",
32
+ "@types/mocha": "^9.1.1",
33
+ "@types/sql.js": "^1.4.3",
34
+ "chai": "^4.3.6",
35
+ "mocha": "^9.2.2",
36
+ "source-map-support": "^0.5.21",
37
+ "typescript": "^4.6.4"
38
+ }
39
+ }