@abaplint/runtime 2.3.40 → 2.3.41
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/abap_regex.js
CHANGED
|
@@ -5,7 +5,10 @@ class ABAPRegExp {
|
|
|
5
5
|
// converts from ABAP specific regex to javascript regex
|
|
6
6
|
static convert(input) {
|
|
7
7
|
let ret = input;
|
|
8
|
-
ret =
|
|
8
|
+
ret = ret.replace(/\[\[:punct:\]\]/g, "[@%\\.\\,\\-\\{\\}\\[\\]\\:\\!\\?\\(\\)\\;\\']");
|
|
9
|
+
// https://github.com/micromatch/posix-character-classes#posix-character-classes
|
|
10
|
+
ret = ret.replace(/\[\^\[:print:\]\]/g, "[\\x00-\\x1F\\x7F]");
|
|
11
|
+
ret = ret.replace("[[:space:]]", "\\s");
|
|
9
12
|
return ret;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Structure, Table } from "../types";
|
|
1
|
+
import { ABAPObject, Structure, Table } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
4
|
export interface IFindOptions {
|
|
5
5
|
find?: ICharacter | string;
|
|
6
6
|
first?: boolean;
|
|
7
|
-
regex?: string | ICharacter;
|
|
7
|
+
regex?: string | ICharacter | ABAPObject;
|
|
8
8
|
offset?: INumeric;
|
|
9
9
|
sectionOffset?: INumeric;
|
|
10
10
|
byteMode?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.find = void 0;
|
|
4
|
+
const abap_regex_1 = require("../abap_regex");
|
|
4
5
|
const types_1 = require("../types");
|
|
5
6
|
function find(input, options) {
|
|
6
7
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -38,11 +39,22 @@ function find(input, options) {
|
|
|
38
39
|
if (typeof r !== "string") {
|
|
39
40
|
r = r.get();
|
|
40
41
|
}
|
|
41
|
-
// check type, it can also be a CL_ABAP_REGEX
|
|
42
42
|
if (typeof r === "string") {
|
|
43
|
-
r =
|
|
43
|
+
r = abap_regex_1.ABAPRegExp.convert(r);
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
else if (r.constructor.name === "cl_abap_regex") {
|
|
46
|
+
const obj = r;
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
r = obj.mv_pattern.get();
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
if (obj.mv_ignore_case.get() === "X") {
|
|
51
|
+
options.ignoringCase = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
throw "find(), unexpected input";
|
|
56
|
+
}
|
|
57
|
+
s = new RegExp(r, "gm" + (options.ignoringCase === true ? "i" : ""));
|
|
46
58
|
}
|
|
47
59
|
else {
|
|
48
60
|
throw "FIND, runtime, no input";
|