@abaplint/runtime 1.8.36 → 1.8.39

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.
@@ -6,6 +6,8 @@ export interface IReplaceInput {
6
6
  sub?: string | ICharacter;
7
7
  with?: string | ICharacter;
8
8
  regex?: string | ICharacter;
9
+ off?: INumeric;
10
+ len?: INumeric;
9
11
  occ?: INumeric;
10
12
  }
11
13
  export declare function replace(input: IReplaceInput): String;
@@ -34,7 +34,12 @@ function replace(input) {
34
34
  else if (input.regex) {
35
35
  sub = input.regex.get();
36
36
  }
37
- if (input.occ === undefined && sub && wi) {
37
+ if (input.off && input.len) {
38
+ const offset = input.off.get();
39
+ const length = input.len.get();
40
+ val = val.substring(0, offset) + wi + val.substring(offset + length);
41
+ }
42
+ else if (input.occ === undefined && sub && wi) {
38
43
  val = val.replace(sub, wi);
39
44
  }
40
45
  else if (input.occ && input.occ.get() === 0 && sub && wi !== undefined) {
@@ -6,6 +6,7 @@ exports.sy = new types_1.Structure({
6
6
  abcde: new types_1.Character({ length: 26 }).set("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
7
7
  datlo: new types_1.Date(),
8
8
  datum: new types_1.Date(),
9
+ fdpos: new types_1.Integer(),
9
10
  index: new types_1.Integer(),
10
11
  langu: new types_1.Character({ length: 1 }).set("E"),
11
12
  mandt: new types_1.Character({ length: 3 }).set("123"),
@@ -16,7 +16,17 @@ function cs(left, right) {
16
16
  else {
17
17
  r = right.get().toString();
18
18
  }
19
- return l.includes(r);
19
+ const index = l.indexOf(r);
20
+ if (index < 0) {
21
+ // @ts-ignore
22
+ abap.builtin.sy.get().fdpos.set(l.length);
23
+ return false;
24
+ }
25
+ else {
26
+ // @ts-ignore
27
+ abap.builtin.sy.get().fdpos.set(index);
28
+ return true;
29
+ }
20
30
  }
21
31
  exports.cs = cs;
22
32
  //# sourceMappingURL=cs.js.map
@@ -1,9 +1,12 @@
1
+ import { Table } from "../types";
1
2
  import { ICharacter } from "../types/_character";
2
3
  import { INumeric } from "../types/_numeric";
3
4
  export interface IDescribeOptions {
4
5
  field: any;
5
6
  type?: ICharacter;
6
7
  length?: INumeric;
8
+ lines?: INumeric;
9
+ table?: Table;
7
10
  mode?: "BYTE" | "CHARACTER";
8
11
  }
9
12
  export declare function describe(input: IDescribeOptions): void;
@@ -69,6 +69,9 @@ function describe(input) {
69
69
  throw "DESCRIBE, unsupported or todo";
70
70
  }
71
71
  }
72
+ if (input.table && input.lines) {
73
+ input.lines.set(input.table.array().length);
74
+ }
72
75
  }
73
76
  exports.describe = describe;
74
77
  //# sourceMappingURL=describe.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "1.8.36",
3
+ "version": "1.8.39",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",