Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.10.5: bugfix REGEX #1451

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@abaplint/transpiler-cli",
"version": "2.10.4",
"version": "2.10.5",
"description": "Transpiler - Command Line Interface",
"funding": "https://github.com/sponsors/larshp",
"bin": {
"abap_transpile": "./abap_transpile"
"abap_transpile": "abap_transpile"
},
"types": "./build/types.d.ts",
"keywords": [
Expand All @@ -26,7 +26,7 @@
"author": "abaplint",
"license": "MIT",
"devDependencies": {
"@abaplint/transpiler": "^2.10.4",
"@abaplint/transpiler": "^2.10.5",
"@types/glob": "^8.1.0",
"glob": "=7.2.0",
"@types/progress": "^2.0.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abaplint/runtime",
"version": "2.10.4",
"version": "2.10.5",
"description": "Transpiler - Runtime",
"main": "build/src/index.js",
"typings": "build/src/index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions packages/runtime/src/abap_regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export class ABAPRegExp {
// https://github.com/micromatch/posix-character-classes#posix-character-classes
ret = ret.replace(/\[\^\[:print:\]\]/g, "[\\x00-\\x1F\\x7F]");

// https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenregex_syntax_specials.htm
ret = ret.replace(/\\C/g, "[a-zA-Z]");

ret = ret.replace("[[:space:]]", "\\s");

return ret;
Expand Down
4 changes: 2 additions & 2 deletions packages/transpiler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/transpiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abaplint/transpiler",
"version": "2.10.4",
"version": "2.10.5",
"description": "Transpiler",
"main": "build/src/index.js",
"typings": "build/src/index.d.ts",
Expand Down
33 changes: 33 additions & 0 deletions test/statements/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,4 +709,37 @@ ASSERT foo = |[?(@.name=='METH1')]|.`;
await f(abap);
});

it("FIND, REGEX slash C", async () => {
const code = `
DATA iv_line TYPE string.
iv_line = 'a'.
FIND FIRST OCCURRENCE OF REGEX '\\C' IN iv_line.
WRITE / sy-subrc.`;
const js = await run(code);
const f = new AsyncFunction("abap", js);
await f(abap);
expect(abap.console.get()).to.equal("0");
});

it("FIND, another REGEX", async () => {
const code = `
DATA iv_line TYPE string.
DATA str1 TYPE string.
DATA str2 TYPE string.
DATA str3 TYPE string.

iv_line = '#FOOO,30: Greetings'.

FIND FIRST OCCURRENCE OF REGEX '^#(\\C{4})(?:,(\\d+))?(?::(.*))'
IN iv_line SUBMATCHES str1 str2 str3.

WRITE / str1.
WRITE / str2.
WRITE / str3.`;
const js = await run(code);
const f = new AsyncFunction("abap", js);
await f(abap);
expect(abap.console.get()).to.equal("FOOO\n30\n Greetings");
});

});