Skip to content

feat: allow spaces in definitions#296

Open
fzipi wants to merge 1 commit intomainfrom
feat/allow-spaces-define
Open

feat: allow spaces in definitions#296
fzipi wants to merge 1 commit intomainfrom
feat/allow-spaces-define

Conversation

@fzipi
Copy link
Member

@fzipi fzipi commented Mar 11, 2026

what

  • allow spaces in definitions

why

  • write definitions that can have spaces

references

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DefinitionRegex to 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.

Comment on lines 16 to 18
// 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.
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// 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.

Copilot uses AI. Check for mistakes.
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.

2 participants