Skip to content

Update PARM_REGEX to match at the start or whitespace#3115

Open
bobcozzi wants to merge 1 commit intocodefori:masterfrom
bobcozzi:fix-regex-boundary
Open

Update PARM_REGEX to match at the start or whitespace#3115
bobcozzi wants to merge 1 commit intocodefori:masterfrom
bobcozzi:fix-regex-boundary

Conversation

@bobcozzi
Copy link
Copy Markdown
Contributor

Now keywords are detected when they appear in column 1 or later. Previously they always required a blank in front of them, but now they can also appear in position/column 1 of the line.

Changes

How to test this PR

Checklist

  • have tested my change
  • have created one or more test cases
  • updated relevant documentation
  • Remove any/all console.logs I added
  • have added myself to the contributors' list in CONTRIBUTING.md

Now keywords can appear in column 1 or anywhere after column 1 provided at least 1 space is detected before the keyword.
@sebjulliand
Copy link
Copy Markdown
Member

@bobcozzi do you have a test case that didn't work before the PR we can use to validate the change ?

@bobcozzi
Copy link
Copy Markdown
Contributor Author

CRTRPGMOD +
MODULE(PICKLES)

@chrjorgensen
Copy link
Copy Markdown
Collaborator

@bobcozzi @sebjulliand Isn't it a multi-command action when newline are in the action string?

From what I know, actions can not have commands split over multiple lines by newlines. Any newline will be considered multiple commands. You may see some commands occupy more than one line, but that's the text input field in the html splitting the line according to the width.

The above example gives this when run:

Commands:
	CRTRPGMOD +
	MODULE(PICKLES)

CPD0078:  Value '+         ' for parameter MODULE not a valid name.
CPD0078:  Value '+         ' for parameter MODULE not a valid name.
CPF0001:  Error found on CRTRPGMOD command.

Since an action can have only one command per line, I think the original regex is okay... 🤔

@bobcozzi
Copy link
Copy Markdown
Contributor Author

bobcozzi commented Mar 18, 2026

I agree that multiline commands are not implemented in actions.
However, even so, the change I made also supports embedded tabs as well as spaces/blanks.
A more accurate change given the single-line command requirement, would be this regex, but my original patch would also work just as well.

const PARM_REGEX = /\s+(PNLGRP|OBJ|PGM|MODULE|FILE|MENU)\((?<object>.+?)\)/;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants