@abaplint/runtime 2.7.41 → 2.7.44
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/builtin/contains.d.ts +4 -1
- package/build/src/builtin/contains.js +13 -1
- package/build/src/statements/modify_internal.d.ts +2 -0
- package/build/src/statements/modify_internal.js +19 -0
- package/build/src/types/character.d.ts +2 -1
- package/build/src/types/character.js +5 -0
- package/package.json +1 -1
|
@@ -3,7 +3,10 @@ import { ICharacter } from "../types/_character";
|
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
4
|
export type ContainsInput = {
|
|
5
5
|
val: ICharacter;
|
|
6
|
-
regex
|
|
6
|
+
regex?: ICharacter;
|
|
7
|
+
sub?: ICharacter;
|
|
8
|
+
start?: ICharacter;
|
|
9
|
+
end?: ICharacter;
|
|
7
10
|
case?: ICharacter;
|
|
8
11
|
off?: INumeric;
|
|
9
12
|
len?: INumeric;
|
|
@@ -9,7 +9,19 @@ function contains(input) {
|
|
|
9
9
|
|| input.occ !== undefined) {
|
|
10
10
|
throw "runtime, contains() todo";
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
let ret = " ";
|
|
13
|
+
if (input.regex) {
|
|
14
|
+
ret = input.val.get().match(input.regex.get()) !== null ? "X" : " ";
|
|
15
|
+
}
|
|
16
|
+
else if (input.sub) {
|
|
17
|
+
ret = input.val.get().includes(input.sub.get()) ? "X" : " ";
|
|
18
|
+
}
|
|
19
|
+
else if (input.start) {
|
|
20
|
+
ret = input.val.get().startsWith(input.start.get()) ? "X" : " ";
|
|
21
|
+
}
|
|
22
|
+
else if (input.end) {
|
|
23
|
+
ret = input.val.get().endsWith(input.end.get()) ? "X" : " ";
|
|
24
|
+
}
|
|
13
25
|
return new types_1.String().set(ret);
|
|
14
26
|
}
|
|
15
27
|
exports.contains = contains;
|
|
@@ -3,5 +3,7 @@ import { INumeric } from "../types/_numeric";
|
|
|
3
3
|
export interface IModifyInternalOptions {
|
|
4
4
|
index: INumeric;
|
|
5
5
|
from: any;
|
|
6
|
+
where?: (i: any) => boolean;
|
|
7
|
+
transporting?: string[];
|
|
6
8
|
}
|
|
7
9
|
export declare function modifyInternal(table: Table, options: IModifyInternalOptions): void;
|
|
@@ -15,6 +15,25 @@ function modifyInternal(table, options) {
|
|
|
15
15
|
table.insertIndex(options.from, index);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
else if (options.where && options.transporting && options.from) {
|
|
19
|
+
let index = 1;
|
|
20
|
+
const fs = new types_1.FieldSymbol();
|
|
21
|
+
while (index <= table.array().length) {
|
|
22
|
+
const currentIndex = new types_1.Integer().set(index);
|
|
23
|
+
const readResult = (0, read_table_1.readTable)(table, {
|
|
24
|
+
withKey: options.where,
|
|
25
|
+
assigning: fs,
|
|
26
|
+
index: currentIndex
|
|
27
|
+
});
|
|
28
|
+
if (readResult.subrc === 0) {
|
|
29
|
+
found = true;
|
|
30
|
+
for (const t of options.transporting) {
|
|
31
|
+
fs.get()[t].set(options.from.get()[t]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
index++;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
18
37
|
else if (options.from) {
|
|
19
38
|
const readResult = (0, read_table_1.readTable)(table, { from: options.from });
|
|
20
39
|
if (readResult.subrc === 0) {
|
|
@@ -4,6 +4,7 @@ import { Structure } from "./structure";
|
|
|
4
4
|
import { AbstractTypeData } from "./_abstract_type_data";
|
|
5
5
|
import { ICharacter } from "./_character";
|
|
6
6
|
import { INumeric } from "./_numeric";
|
|
7
|
+
import { Integer } from "./integer";
|
|
7
8
|
export declare class Character implements ICharacter {
|
|
8
9
|
private value;
|
|
9
10
|
private constant;
|
|
@@ -11,7 +12,7 @@ export declare class Character implements ICharacter {
|
|
|
11
12
|
private readonly extra;
|
|
12
13
|
constructor(length?: number, extra?: AbstractTypeData);
|
|
13
14
|
setConstant(): this;
|
|
14
|
-
set(value: ICharacter | string | Structure | FieldSymbol): this;
|
|
15
|
+
set(value: ICharacter | string | Structure | FieldSymbol | Integer): this;
|
|
15
16
|
getQualifiedName(): string | undefined;
|
|
16
17
|
getConversionExit(): string | undefined;
|
|
17
18
|
getDDICName(): string | undefined;
|
|
@@ -5,6 +5,7 @@ const _parse_1 = require("../operators/_parse");
|
|
|
5
5
|
const throw_error_1 = require("../throw_error");
|
|
6
6
|
const field_symbol_1 = require("./field_symbol");
|
|
7
7
|
const structure_1 = require("./structure");
|
|
8
|
+
const integer_1 = require("./integer");
|
|
8
9
|
const TRIMREGEX = / *$/;
|
|
9
10
|
class Character {
|
|
10
11
|
constructor(length, extra) {
|
|
@@ -41,6 +42,10 @@ class Character {
|
|
|
41
42
|
this.set(value.getCharacter());
|
|
42
43
|
return this;
|
|
43
44
|
}
|
|
45
|
+
else if (value instanceof integer_1.Integer) {
|
|
46
|
+
this.value = Math.abs(value.get()) + (value.get() < 0 ? "-" : " ");
|
|
47
|
+
this.value = this.value.padStart(this.length, " ");
|
|
48
|
+
}
|
|
44
49
|
else {
|
|
45
50
|
this.value = value.get() + "";
|
|
46
51
|
}
|