fix: /xx ignores spaces and tabs inside character classes#39
Draft
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
fix: /xx ignores spaces and tabs inside character classes#39toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
Under /xx (Perl 5.26+), unescaped SPACE and TAB characters inside bracketed character classes should be ignored. The parser was treating them as literal anyof_char nodes, producing incorrect parse trees. Added skip logic in the cc handler that checks for the xx flag bit (0x200) and consumes spaces/tabs without creating nodes. Escaped spaces (\ ) are correctly preserved since they go through the backslash handler before reaching the literal catch-all. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Under
/xx(Perl 5.26+), unescaped spaces and tabs inside[...]character classes are now correctly ignored during parsing.Why
The parser was treating spaces and tabs as literal
anyof_charnodes under/xx, producing parse trees that didn't match Perl's actual semantics. For example,(?xx:[a b c])created three character nodes (a,,b,c) instead of two (a,b,c).How
Added a check in the
cchandler (Handlers.pm) before the literal character catch-all: when the/xxflag bit (0x200) is active, consume and skip space/tab runs viaredo. Escaped spaces (\) are unaffected since they route through the backslash handler first.Testing
t/08regex_flags.tcovering: space stripping, tab stripping, newline preservation, escaped space preservation, inline(?xx:)syntax, and/xvs/xxcomparison/xxcharacter class patterns🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 29 insertions(+), 1 deletion(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline