@abaplint/runtime 2.0.30 → 2.0.33

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.
@@ -29,6 +29,9 @@ function replace(input) {
29
29
  }
30
30
  else {
31
31
  replace = input.with.get();
32
+ replace = replace.replace(/\\\$/g, "$");
33
+ replace = replace.replace(/\\\{/g, "{");
34
+ replace = replace.replace(/\\\}/g, "}");
32
35
  }
33
36
  if (input.all === true) {
34
37
  if (input.regex) {
@@ -8,12 +8,13 @@ declare type PointerType = INumeric | Table | ICharacter | ABAPObject | undefine
8
8
  export declare class FieldSymbol {
9
9
  private pointer;
10
10
  private casting;
11
- constructor();
11
+ private readonly type;
12
+ constructor(type?: PointerType);
12
13
  assign(pointer: PointerType): void;
13
14
  setCasting(): void;
14
15
  unassign(): void;
15
16
  isAssigned(): boolean;
16
- getPointer(): PointerType;
17
+ getPointer(): any;
17
18
  clear(): void | Structure | undefined;
18
19
  get(): any;
19
20
  appendInitial(): import("./table").TableRowType | undefined;
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FieldSymbol = void 0;
4
4
  const table_1 = require("./table");
5
5
  const string_1 = require("./string");
6
+ const hex_1 = require("./hex");
6
7
  class FieldSymbol {
7
- // todo, add typing, so its possible to get runtime errors?
8
- constructor() {
8
+ constructor(type) {
9
9
  this.pointer = undefined;
10
10
  this.casting = false;
11
+ this.type = type;
11
12
  }
12
13
  assign(pointer) {
13
14
  this.pointer = pointer;
@@ -22,6 +23,10 @@ class FieldSymbol {
22
23
  return this.pointer !== undefined;
23
24
  }
24
25
  getPointer() {
26
+ if (this.casting) {
27
+ // todo, this wont work for everything, eg changing CASTING'ed values
28
+ return this.get();
29
+ }
25
30
  return this.pointer;
26
31
  }
27
32
  ///////////////
@@ -30,14 +35,22 @@ class FieldSymbol {
30
35
  return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.clear();
31
36
  }
32
37
  get() {
33
- var _a, _b;
38
+ var _a, _b, _c;
34
39
  if (this.casting) {
35
- // @ts-ignore
36
- return new string_1.String().set(Buffer.from((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.get(), "hex").toString()).get();
40
+ if (this.type instanceof hex_1.Hex) {
41
+ // @ts-ignore
42
+ const ret = new string_1.String().set(Buffer.from((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.get(), "utf16le").toString("hex"));
43
+ return ret.get();
44
+ }
45
+ else {
46
+ // @ts-ignore
47
+ const ret = new string_1.String().set(Buffer.from((_b = this.pointer) === null || _b === void 0 ? void 0 : _b.get(), "hex").toString("utf16le"));
48
+ return ret.get();
49
+ }
37
50
  }
38
51
  else {
39
52
  // @ts-ignore
40
- return (_b = this.pointer) === null || _b === void 0 ? void 0 : _b.get();
53
+ return (_c = this.pointer) === null || _c === void 0 ? void 0 : _c.get();
41
54
  }
42
55
  }
43
56
  appendInitial() {
@@ -38,6 +38,9 @@ class Hex {
38
38
  }
39
39
  else {
40
40
  this.value = v;
41
+ if (this.value.match(/^(?![A-F0-9])/)) {
42
+ this.value = "";
43
+ }
41
44
  }
42
45
  }
43
46
  if (this.value.length > this.length * 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.0.30",
3
+ "version": "2.0.33",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",