Conversation
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
There was a problem hiding this comment.
Pull request overview
This PR updates the regex-assembly “define” directive parsing to allow definition values that contain spaces, and adds regression tests to ensure spaces are preserved in parsed definition values.
Changes:
- Expand
DefinitionRegexto capture multi-token definition values (including spaces). - Add parser tests covering definition values containing spaces (including within character classes).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
regex/definitions.go |
Updates DefinitionRegex so definition values can include spaces. |
regex/parser/definition_test.go |
Adds tests validating parsing/substitution when definition values contain spaces. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // DefinitionRegex matches a definition processor line (##! define <name> <value>) | ||
| // Everything up to the value of the definition is captured in group 1. | ||
| // The name is captured in group 2, the value in group 3. |
There was a problem hiding this comment.
The doc comment for DefinitionRegex says the directive format is ##! define <name> <value>, but the actual directive syntax (and the regex) is ##!> define .... Since this line is being modified, please update the comment to match the real directive and (optionally) note that the value may contain spaces now.
| // DefinitionRegex matches a definition processor line (##! define <name> <value>) | |
| // Everything up to the value of the definition is captured in group 1. | |
| // The name is captured in group 2, the value in group 3. | |
| // DefinitionRegex matches a definition processor line (##!> define <name> <value>). | |
| // Everything up to the value of the definition is captured in group 1. | |
| // The name is captured in group 2, the value (which may contain spaces) in group 3. |
what
why
references