@abaplint/runtime 2.2.16 → 2.2.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.
- package/build/src/offset_length.d.ts +2 -2
- package/build/src/offset_length.js +1 -1
- package/build/src/operators/add.d.ts +1 -1
- package/build/src/operators/minus.d.ts +1 -1
- package/build/src/operators/multiply.d.ts +1 -1
- package/build/src/statements/index.d.ts +2 -0
- package/build/src/statements/index.js +2 -0
- package/build/src/statements/message.js +1 -1
- package/build/src/statements/overlay.d.ts +3 -0
- package/build/src/statements/overlay.js +11 -0
- package/build/src/statements/write.js +2 -4
- package/build/src/template_formatting.js +13 -1
- package/build/src/types/abap_object.js +4 -0
- package/build/src/types/character.js +11 -6
- package/build/src/types/data_reference.d.ts +1 -1
- package/build/src/types/structure.d.ts +7 -0
- package/build/src/types/structure.js +42 -0
- package/build/src/types/table.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Character } from "./types";
|
|
1
|
+
import { Character, Hex, Structure, XString } from "./types";
|
|
2
2
|
import { ICharacter } from "./types/_character";
|
|
3
3
|
import { INumeric } from "./types/_numeric";
|
|
4
4
|
export interface IOffsetLengthOptions {
|
|
@@ -10,7 +10,7 @@ export declare class OffsetLength {
|
|
|
10
10
|
private readonly offset?;
|
|
11
11
|
private readonly length?;
|
|
12
12
|
private readonly isHex;
|
|
13
|
-
constructor(obj: Character, options: IOffsetLengthOptions);
|
|
13
|
+
constructor(obj: Character | Hex | XString | Structure, options: IOffsetLengthOptions);
|
|
14
14
|
get(): string;
|
|
15
15
|
set(value: ICharacter | string): void;
|
|
16
16
|
}
|
|
@@ -49,7 +49,7 @@ class OffsetLength {
|
|
|
49
49
|
else {
|
|
50
50
|
val = value.get() + "";
|
|
51
51
|
}
|
|
52
|
-
let old = this.obj.get();
|
|
52
|
+
let old = this.obj instanceof types_1.Structure ? this.obj.getCharacter() : this.obj.get();
|
|
53
53
|
if (this.obj instanceof types_1.Character) {
|
|
54
54
|
old = old.padEnd(this.obj.getLength(), " ");
|
|
55
55
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Float, Hex, Integer } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function add(left: INumeric | ICharacter | string | number | Float | Integer | Hex, right: INumeric | ICharacter | string | number | Float | Integer | Hex):
|
|
4
|
+
export declare function add(left: INumeric | ICharacter | string | number | Float | Integer | Hex, right: INumeric | ICharacter | string | number | Float | Integer | Hex): Float | Integer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Float, Integer } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function minus(left: INumeric | ICharacter | string | number | Integer | Float, right: INumeric | ICharacter | string | number | Integer | Float):
|
|
4
|
+
export declare function minus(left: INumeric | ICharacter | string | number | Integer | Float, right: INumeric | ICharacter | string | number | Integer | Float): Float | Integer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Float, Integer } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function multiply(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number):
|
|
4
|
+
export declare function multiply(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float | Integer;
|
|
@@ -10,6 +10,7 @@ import { createData } from "./create_data";
|
|
|
10
10
|
import { deleteInternal } from "./delete_internal";
|
|
11
11
|
import { describe } from "./describe";
|
|
12
12
|
import { find } from "./find";
|
|
13
|
+
import { overlay } from "./overlay";
|
|
13
14
|
import { cast } from "./cast";
|
|
14
15
|
import { getBit } from "./get_bit";
|
|
15
16
|
import { getLocale } from "./get_locale";
|
|
@@ -55,6 +56,7 @@ export declare class Statements {
|
|
|
55
56
|
deleteInternal: typeof deleteInternal;
|
|
56
57
|
describe: typeof describe;
|
|
57
58
|
find: typeof find;
|
|
59
|
+
overlay: typeof overlay;
|
|
58
60
|
getParameter: typeof getParameter;
|
|
59
61
|
getBit: typeof getBit;
|
|
60
62
|
getLocale: typeof getLocale;
|
|
@@ -13,6 +13,7 @@ const create_data_1 = require("./create_data");
|
|
|
13
13
|
const delete_internal_1 = require("./delete_internal");
|
|
14
14
|
const describe_1 = require("./describe");
|
|
15
15
|
const find_1 = require("./find");
|
|
16
|
+
const overlay_1 = require("./overlay");
|
|
16
17
|
const cast_1 = require("./cast");
|
|
17
18
|
const get_bit_1 = require("./get_bit");
|
|
18
19
|
const get_locale_1 = require("./get_locale");
|
|
@@ -57,6 +58,7 @@ class Statements {
|
|
|
57
58
|
this.deleteInternal = delete_internal_1.deleteInternal;
|
|
58
59
|
this.describe = describe_1.describe;
|
|
59
60
|
this.find = find_1.find;
|
|
61
|
+
this.overlay = overlay_1.overlay;
|
|
60
62
|
this.getParameter = get_parameter_1.getParameter;
|
|
61
63
|
this.getBit = get_bit_1.getBit;
|
|
62
64
|
this.getLocale = get_locale_1.getLocale;
|
|
@@ -40,7 +40,7 @@ async function findText(context, arbgb, msgnr, msgty) {
|
|
|
40
40
|
}
|
|
41
41
|
if (text === undefined) {
|
|
42
42
|
// fallback
|
|
43
|
-
text = msgty + ":" + arbgb + ":" + msgnr + " &1 &2 &3 &4";
|
|
43
|
+
text = msgty + ":" + (arbgb === null || arbgb === void 0 ? void 0 : arbgb.trim()) + ":" + msgnr + " &1 &2 &3 &4";
|
|
44
44
|
}
|
|
45
45
|
return text;
|
|
46
46
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.overlay = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
function overlay(value, _withh, _only) {
|
|
6
|
+
const set = value instanceof types_1.Structure ? value.getCharacter() : value.get();
|
|
7
|
+
console.dir(set.length);
|
|
8
|
+
value.set(set);
|
|
9
|
+
}
|
|
10
|
+
exports.overlay = overlay;
|
|
11
|
+
//# sourceMappingURL=overlay.js.map
|
|
@@ -20,10 +20,8 @@ class WriteStatement {
|
|
|
20
20
|
result = source.toString();
|
|
21
21
|
}
|
|
22
22
|
else if (source instanceof types_1.Structure) {
|
|
23
|
-
const obj = source.
|
|
24
|
-
|
|
25
|
-
this.write(obj[f], Object.assign({}, options));
|
|
26
|
-
}
|
|
23
|
+
const obj = source.getCharacter();
|
|
24
|
+
this.write(obj, Object.assign({}, options));
|
|
27
25
|
}
|
|
28
26
|
else if (source instanceof types_1.Float) {
|
|
29
27
|
if (((_a = options === null || options === void 0 ? void 0 : options.exponent) === null || _a === void 0 ? void 0 : _a.get()) === 0) {
|
|
@@ -43,11 +43,23 @@ function templateFormatting(source, options) {
|
|
|
43
43
|
text = text.trimEnd().padEnd(options.width, " ");
|
|
44
44
|
}
|
|
45
45
|
else if ((options === null || options === void 0 ? void 0 : options.decimals) && source instanceof types_1.Integer) {
|
|
46
|
-
text = source.get()
|
|
46
|
+
text = source.get().toFixed(options.decimals);
|
|
47
47
|
}
|
|
48
48
|
else if ((options === null || options === void 0 ? void 0 : options.decimals) && source instanceof types_1.Packed) {
|
|
49
49
|
text = source.get().toFixed(options.decimals);
|
|
50
50
|
}
|
|
51
|
+
else if ((options === null || options === void 0 ? void 0 : options.decimals) && source instanceof types_1.Float) {
|
|
52
|
+
text = source.getRaw().toFixed(options.decimals);
|
|
53
|
+
}
|
|
54
|
+
else if (source instanceof types_1.Float) {
|
|
55
|
+
const raw = source.getRaw();
|
|
56
|
+
if (Number.isInteger(raw)) {
|
|
57
|
+
text = raw.toFixed(0);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
text = raw.toFixed(16);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
51
63
|
return text;
|
|
52
64
|
}
|
|
53
65
|
exports.templateFormatting = templateFormatting;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ABAPObject = void 0;
|
|
4
|
+
const field_symbol_1 = require("./field_symbol");
|
|
4
5
|
class ABAPObject {
|
|
5
6
|
constructor(input) {
|
|
6
7
|
this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
|
|
@@ -19,6 +20,9 @@ class ABAPObject {
|
|
|
19
20
|
if (value instanceof ABAPObject) {
|
|
20
21
|
this.value = value.get();
|
|
21
22
|
}
|
|
23
|
+
else if (value instanceof field_symbol_1.FieldSymbol) {
|
|
24
|
+
this.value = value.getPointer().get();
|
|
25
|
+
}
|
|
22
26
|
else {
|
|
23
27
|
this.value = value;
|
|
24
28
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Character = void 0;
|
|
4
4
|
const _parse_1 = require("../operators/_parse");
|
|
5
|
+
// eslint-disable-next-line prefer-const
|
|
6
|
+
let featureFixLength = false;
|
|
5
7
|
class Character {
|
|
6
8
|
constructor(input) {
|
|
7
9
|
this.length = (input === null || input === void 0 ? void 0 : input.length) ? input === null || input === void 0 ? void 0 : input.length : 1;
|
|
@@ -20,9 +22,9 @@ class Character {
|
|
|
20
22
|
}
|
|
21
23
|
if (this.value.length > this.length) {
|
|
22
24
|
this.value = this.value.substr(0, this.length);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
}
|
|
26
|
+
else if (featureFixLength && this.value.length < this.length) {
|
|
27
|
+
this.value.padEnd(this.length, " ");
|
|
26
28
|
}
|
|
27
29
|
return this;
|
|
28
30
|
}
|
|
@@ -33,9 +35,12 @@ class Character {
|
|
|
33
35
|
return this.length;
|
|
34
36
|
}
|
|
35
37
|
clear() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
if (featureFixLength) {
|
|
39
|
+
this.value = " ".repeat(this.length);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.value = "";
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
get() {
|
|
41
46
|
return this.value;
|
|
@@ -18,7 +18,7 @@ export declare class DataReference {
|
|
|
18
18
|
clear(): void;
|
|
19
19
|
get(): any;
|
|
20
20
|
array(): any;
|
|
21
|
-
set(value: any): void |
|
|
21
|
+
set(value: any): void | INumeric | Float | ICharacter | Structure | Table | ABAPObject;
|
|
22
22
|
getOffset(input: {
|
|
23
23
|
offset?: number | INumeric | Hex;
|
|
24
24
|
length?: number | INumeric | Hex;
|
|
@@ -2,6 +2,8 @@ import { FieldSymbol } from "./field_symbol";
|
|
|
2
2
|
import { Table } from "./table";
|
|
3
3
|
import { ICharacter } from "./_character";
|
|
4
4
|
import { INumeric } from "./_numeric";
|
|
5
|
+
import { Hex } from "./hex";
|
|
6
|
+
import { Character } from "./character";
|
|
5
7
|
export declare class Structure {
|
|
6
8
|
private readonly value;
|
|
7
9
|
private readonly qualifiedName;
|
|
@@ -11,4 +13,9 @@ export declare class Structure {
|
|
|
11
13
|
set(input: Structure | string | INumeric | Table | ICharacter | FieldSymbol | undefined): this | undefined;
|
|
12
14
|
private setCharacter;
|
|
13
15
|
get(): any;
|
|
16
|
+
getCharacter(): string;
|
|
17
|
+
getOffset(input: {
|
|
18
|
+
offset?: number | INumeric | Hex;
|
|
19
|
+
length?: number | INumeric | Hex;
|
|
20
|
+
}): Character;
|
|
14
21
|
}
|
|
@@ -4,6 +4,8 @@ exports.Structure = void 0;
|
|
|
4
4
|
const clone_1 = require("../clone");
|
|
5
5
|
const field_symbol_1 = require("./field_symbol");
|
|
6
6
|
const table_1 = require("./table");
|
|
7
|
+
const _parse_1 = require("../operators/_parse");
|
|
8
|
+
const character_1 = require("./character");
|
|
7
9
|
class Structure {
|
|
8
10
|
constructor(fields, qualifiedName) {
|
|
9
11
|
this.value = fields;
|
|
@@ -69,6 +71,46 @@ class Structure {
|
|
|
69
71
|
get() {
|
|
70
72
|
return this.value;
|
|
71
73
|
}
|
|
74
|
+
getCharacter() {
|
|
75
|
+
let val = "";
|
|
76
|
+
for (const v in this.value) {
|
|
77
|
+
val += this.value[v].get();
|
|
78
|
+
}
|
|
79
|
+
return val;
|
|
80
|
+
}
|
|
81
|
+
getOffset(input) {
|
|
82
|
+
if (input === null || input === void 0 ? void 0 : input.offset) {
|
|
83
|
+
input.offset = (0, _parse_1.parse)(input.offset);
|
|
84
|
+
}
|
|
85
|
+
if (input === null || input === void 0 ? void 0 : input.length) {
|
|
86
|
+
input.length = (0, _parse_1.parse)(input.length);
|
|
87
|
+
}
|
|
88
|
+
const val = this.getCharacter();
|
|
89
|
+
if ((input.offset && input.offset >= val.length)
|
|
90
|
+
|| (input.offset && input.offset < 0)
|
|
91
|
+
|| (input.length && input.length < 0)) {
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
if (abap.Classes["CX_SY_RANGE_OUT_OF_BOUNDS"] !== undefined) {
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
throw new abap.Classes["CX_SY_RANGE_OUT_OF_BOUNDS"]();
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
throw "Global class CX_SY_RANGE_OUT_OF_BOUNDS not found";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
let ret = val;
|
|
102
|
+
if (input === null || input === void 0 ? void 0 : input.offset) {
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
ret = ret.substr(input.offset);
|
|
105
|
+
}
|
|
106
|
+
if ((input === null || input === void 0 ? void 0 : input.length) !== undefined) {
|
|
107
|
+
// @ts-ignore
|
|
108
|
+
ret = ret.substr(0, input.length);
|
|
109
|
+
}
|
|
110
|
+
const r = new character_1.Character({ length: ret.length });
|
|
111
|
+
r.set(ret);
|
|
112
|
+
return r;
|
|
113
|
+
}
|
|
72
114
|
}
|
|
73
115
|
exports.Structure = Structure;
|
|
74
116
|
//# sourceMappingURL=structure.js.map
|
|
@@ -39,7 +39,7 @@ export declare class Table {
|
|
|
39
39
|
set(tab: Table): void;
|
|
40
40
|
insertIndex(item: TableRowType, index: number): TableRowType;
|
|
41
41
|
deleteIndex(index: number): void;
|
|
42
|
-
append(item: TableRowType, cloneRow?: boolean): FieldSymbol |
|
|
42
|
+
append(item: TableRowType, cloneRow?: boolean): FieldSymbol | DataReference | TableRowType;
|
|
43
43
|
appendInitial(): TableRowType;
|
|
44
44
|
sort(compareFn: (a: TableRowType, b: TableRowType) => number): void;
|
|
45
45
|
private getValue;
|