@abaplint/runtime 2.13.26 → 2.13.28
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.
|
@@ -4,12 +4,16 @@ exports.match = match;
|
|
|
4
4
|
const string_1 = require("../types/string");
|
|
5
5
|
function match(input) {
|
|
6
6
|
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
7
|
+
const regexInput = input.pcre || input.regex;
|
|
8
|
+
if (regexInput === undefined) {
|
|
9
|
+
throw "match() requires either regex or pcre parameter";
|
|
10
|
+
}
|
|
7
11
|
let reg = "";
|
|
8
|
-
if (typeof
|
|
9
|
-
reg =
|
|
12
|
+
if (typeof regexInput === "string") {
|
|
13
|
+
reg = regexInput;
|
|
10
14
|
}
|
|
11
15
|
else {
|
|
12
|
-
reg =
|
|
16
|
+
reg = regexInput.get();
|
|
13
17
|
}
|
|
14
18
|
const r = new RegExp(reg);
|
|
15
19
|
const res = val.match(r);
|
|
@@ -38,11 +38,12 @@ function replace(input) {
|
|
|
38
38
|
if (sub !== undefined) {
|
|
39
39
|
sub = abap_regex_1.ABAPRegExp.escapeRegExp(sub);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const regexInput = input.pcre || input.regex;
|
|
42
|
+
if (typeof regexInput === "string") {
|
|
43
|
+
sub = new RegExp(abap_regex_1.ABAPRegExp.convert(regexInput), "g");
|
|
43
44
|
}
|
|
44
|
-
else if (
|
|
45
|
-
sub = new RegExp(abap_regex_1.ABAPRegExp.convert(
|
|
45
|
+
else if (regexInput) {
|
|
46
|
+
sub = new RegExp(abap_regex_1.ABAPRegExp.convert(regexInput.get()), "g");
|
|
46
47
|
}
|
|
47
48
|
if (input.off && input.len && typeof input.val === "string") {
|
|
48
49
|
const offset = input.off.get();
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { FieldSymbol } from "./types";
|
|
2
|
-
|
|
1
|
+
import { FieldSymbol, HashedTable, Table } from "./types";
|
|
2
|
+
type DynamicCondition = string | Table | HashedTable | {
|
|
3
|
+
get(): string;
|
|
4
|
+
};
|
|
5
|
+
export declare function expandDynamic(input: DynamicCondition, evaluate: (name: string) => FieldSymbol | undefined): string;
|
|
6
|
+
export {};
|
|
@@ -3,8 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.expandDynamic = expandDynamic;
|
|
4
4
|
const expand_in_1 = require("./expand_in");
|
|
5
5
|
const types_1 = require("./types");
|
|
6
|
-
function expandDynamic(
|
|
6
|
+
function expandDynamic(input, evaluate) {
|
|
7
7
|
// console.dir(code);
|
|
8
|
+
let code;
|
|
9
|
+
if (input instanceof types_1.Table || input instanceof types_1.HashedTable) {
|
|
10
|
+
code = input.array().map(row => row.get()).join(" ");
|
|
11
|
+
}
|
|
12
|
+
else if (typeof input === "string") {
|
|
13
|
+
code = input;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
code = input.get();
|
|
17
|
+
}
|
|
8
18
|
if (code === "") {
|
|
9
19
|
return "1 = 1";
|
|
10
20
|
}
|