@abaplint/runtime 1.7.6 → 1.7.10

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.
@@ -9,6 +9,7 @@ exports.sy = new types_1.Structure({
9
9
  index: new types_1.Integer(),
10
10
  langu: new types_1.Character({ length: 1 }).set("E"),
11
11
  mandt: new types_1.Character({ length: 3 }).set("123"),
12
+ sysid: new types_1.Character({ length: 3 }).set("ABC"),
12
13
  msgid: new types_1.Character({ length: 20 }),
13
14
  msgno: new types_1.Numc({ length: 3 }),
14
15
  msgv1: new types_1.Character({ length: 50 }),
@@ -13,7 +13,7 @@ function clone(obj) {
13
13
  return n;
14
14
  }
15
15
  else if (obj instanceof types_1.DataReference) {
16
- const n = new types_1.DataReference();
16
+ const n = new types_1.DataReference(obj.getType());
17
17
  n.assign(obj.getPointer());
18
18
  // @ts-ignore
19
19
  return n;
@@ -50,6 +50,9 @@ class OffsetLength {
50
50
  val = value.get() + "";
51
51
  }
52
52
  let old = this.obj.get();
53
+ if (this.obj instanceof types_1.Character) {
54
+ old = old.padEnd(this.obj.getLength(), " ");
55
+ }
53
56
  if (this.length) {
54
57
  val = val.substr(0, this.length);
55
58
  if (this.isHex) {
@@ -65,6 +68,7 @@ class OffsetLength {
65
68
  else if (this.offset) {
66
69
  old = old.substr(0, this.offset) + val;
67
70
  }
71
+ old = old.trimEnd();
68
72
  this.obj.set(old);
69
73
  }
70
74
  }
@@ -0,0 +1,2 @@
1
+ import { DataReference } from "../types";
2
+ export declare function createData(target: DataReference): void;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createData = void 0;
4
+ const clone_1 = require("../clone");
5
+ function createData(target) {
6
+ target.assign((0, clone_1.clone)(target.getType()));
7
+ }
8
+ exports.createData = createData;
9
+ //# sourceMappingURL=create_data.js.map
@@ -66,6 +66,9 @@ function find(input, options) {
66
66
  if (matches[0] && matches[0][index + 1]) {
67
67
  options.submatches[index].set(matches[0][index + 1]);
68
68
  }
69
+ else if (matches.length > 0) {
70
+ options.submatches[index].clear();
71
+ }
69
72
  }
70
73
  }
71
74
  if (options.results) {
@@ -10,6 +10,7 @@ import { convert } from "./convert";
10
10
  import { deleteInternal } from "./delete_internal";
11
11
  import { describe } from "./describe";
12
12
  import { find } from "./find";
13
+ import { createData } from "./create_data";
13
14
  import { getRunTime } from "./get_run_time";
14
15
  import { getBit } from "./get_bit";
15
16
  import { getTime } from "./get_time";
@@ -37,11 +38,12 @@ export declare class Statements {
37
38
  concatenate: typeof concatenate;
38
39
  condense: typeof condense;
39
40
  convert: typeof convert;
41
+ createData: typeof createData;
40
42
  deleteInternal: typeof deleteInternal;
41
43
  describe: typeof describe;
42
44
  find: typeof find;
43
- getRunTime: typeof getRunTime;
44
45
  getBit: typeof getBit;
46
+ getRunTime: typeof getRunTime;
45
47
  getTime: typeof getTime;
46
48
  insertInternal: typeof insertInternal;
47
49
  loop: typeof loop;
@@ -12,6 +12,7 @@ const convert_1 = require("./convert");
12
12
  const delete_internal_1 = require("./delete_internal");
13
13
  const describe_1 = require("./describe");
14
14
  const find_1 = require("./find");
15
+ const create_data_1 = require("./create_data");
15
16
  const get_run_time_1 = require("./get_run_time");
16
17
  const get_bit_1 = require("./get_bit");
17
18
  const get_time_1 = require("./get_time");
@@ -42,11 +43,12 @@ class Statements {
42
43
  this.concatenate = concatenate_1.concatenate;
43
44
  this.condense = condense_1.condense;
44
45
  this.convert = convert_1.convert;
46
+ this.createData = create_data_1.createData;
45
47
  this.deleteInternal = delete_internal_1.deleteInternal;
46
48
  this.describe = describe_1.describe;
47
49
  this.find = find_1.find;
48
- this.getRunTime = get_run_time_1.getRunTime;
49
50
  this.getBit = get_bit_1.getBit;
51
+ this.getRunTime = get_run_time_1.getRunTime;
50
52
  this.getTime = get_time_1.getTime;
51
53
  this.insertInternal = insert_internal_1.insertInternal;
52
54
  this.loop = loop_1.loop;
@@ -17,6 +17,7 @@ function replace(input, all, s, r) {
17
17
  else {
18
18
  replace = r.get();
19
19
  }
20
+ const found = temp.indexOf(search) >= 0;
20
21
  if (all === true) {
21
22
  if (search.length === 0) {
22
23
  throw "REPLACE, zero length input";
@@ -28,6 +29,9 @@ function replace(input, all, s, r) {
28
29
  else {
29
30
  temp = temp.replace(search, replace);
30
31
  }
32
+ const subrc = found ? 0 : 4;
33
+ // @ts-ignore
34
+ abap.builtin.sy.get().subrc.set(subrc);
31
35
  input.set(temp);
32
36
  }
33
37
  exports.replace = replace;
@@ -47,6 +47,14 @@ function shift_character_mode(target, options) {
47
47
  value = value.substr(index);
48
48
  }
49
49
  }
50
+ else {
51
+ if (options === null || options === void 0 ? void 0 : options.circular) {
52
+ value = value.substr(1) + value.substr(0, 1);
53
+ }
54
+ else {
55
+ value = value.substr(1);
56
+ }
57
+ }
50
58
  target.set(value);
51
59
  }
52
60
  function shift_byte_mode(target, options) {
@@ -7,7 +7,9 @@ import { Structure } from "./structure";
7
7
  declare type PointerType = INumeric | Table | ICharacter | ABAPObject | undefined | Structure;
8
8
  export declare class DataReference {
9
9
  private pointer;
10
- constructor();
10
+ private readonly type;
11
+ constructor(type: PointerType);
12
+ getType(): PointerType;
11
13
  assign(pointer: PointerType): void;
12
14
  unassign(): void;
13
15
  getPointer(): PointerType;
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataReference = void 0;
4
4
  const string_1 = require("./string");
5
5
  class DataReference {
6
- // todo, add typing, so its possible to get runtime errors?
7
- constructor() {
6
+ constructor(type) {
8
7
  this.pointer = undefined;
8
+ this.type = type;
9
+ }
10
+ getType() {
11
+ return this.type;
9
12
  }
10
13
  assign(pointer) {
11
14
  this.pointer = pointer;
@@ -95,7 +95,7 @@ class Table {
95
95
  return item;
96
96
  }
97
97
  else if (item instanceof data_reference_1.DataReference) {
98
- const ref = new data_reference_1.DataReference();
98
+ const ref = new data_reference_1.DataReference(item.getType());
99
99
  ref.assign(item.getPointer());
100
100
  this.value.push(ref);
101
101
  return ref;
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
- {
2
- "name": "@abaplint/runtime",
3
- "version": "1.7.6",
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:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
14
- "publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
15
- "test": "npm run compile && mocha"
16
- },
17
- "mocha": {
18
- "recursive": true,
19
- "reporter": "progress",
20
- "spec": "build/test/**/*.js",
21
- "require": "source-map-support/register"
22
- },
23
- "keywords": [
24
- "ABAP",
25
- "abaplint"
26
- ],
27
- "author": "abaplint",
28
- "license": "MIT",
29
- "dependencies": {
30
- "hdb": "^0.19.1",
31
- "sql.js": "^1.6.2"
32
- },
33
- "devDependencies": {
34
- "@types/chai": "^4.3.0",
35
- "@types/mocha": "^9.0.0",
36
- "@types/sql.js": "^1.4.3",
37
- "chai": "^4.3.4",
38
- "mocha": "^9.1.3",
39
- "source-map-support": "^0.5.21",
40
- "typescript": "^4.5.4"
41
- }
42
- }
1
+ {
2
+ "name": "@abaplint/runtime",
3
+ "version": "1.7.10",
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:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
14
+ "publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
15
+ "test": "npm run compile && mocha"
16
+ },
17
+ "mocha": {
18
+ "recursive": true,
19
+ "reporter": "progress",
20
+ "spec": "build/test/**/*.js",
21
+ "require": "source-map-support/register"
22
+ },
23
+ "keywords": [
24
+ "ABAP",
25
+ "abaplint"
26
+ ],
27
+ "author": "abaplint",
28
+ "license": "MIT",
29
+ "dependencies": {
30
+ "hdb": "^0.19.1",
31
+ "sql.js": "^1.6.2"
32
+ },
33
+ "devDependencies": {
34
+ "@types/chai": "^4.3.0",
35
+ "@types/mocha": "^9.0.0",
36
+ "@types/sql.js": "^1.4.3",
37
+ "chai": "^4.3.4",
38
+ "mocha": "^9.1.3",
39
+ "source-map-support": "^0.5.21",
40
+ "typescript": "^4.5.4"
41
+ }
42
+ }