fix: branch_reset qr() crash + 86-test qr() suite#36
Draft
toddr-bot wants to merge 3 commits intocpan-authors:mainfrom
Draft
fix: branch_reset qr() crash + 86-test qr() suite#36toddr-bot wants to merge 3 commits intocpan-authors:mainfrom
toddr-bot wants to merge 3 commits intocpan-authors:mainfrom
Conversation
The qr() method in Parser.pm checked `family eq 'group'` to detect non-capturing groups and extract their flags. Since branch_reset also has family 'group' but no on()/off() methods, calling qr() on a regex like (?|(a)|(b)) crashed with "Can't locate object method 'on'". Fix: check `type eq 'group'` instead, which only matches the non-capturing group construct that actually has flag accessors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comprehensive test that verifies the full pipeline: source pattern → parse → tree → qr() → match. Covers literals, anchors, quantifiers, possessive quantifiers, character classes, shorthand classes, flags, caret flags, lookahead/lookbehind, atomic groups, named captures, branch reset, backtracking verbs, \K, script runs, quotemeta, Unicode properties, POSIX classes, \R/\h/\v/\X, conditionals, named characters, and escape sequences. Previously qr() was only tested incidentally in ~5 files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…erls
(*script_run:) requires Perl 5.30+ and \N{NAME} in runtime patterns
requires lexer-time resolution only available in 5.30+. Both tests now
skip gracefully on older Perl versions instead of failing.
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
Fixes
qr()method crash when called on regexes containing(?|...)branch reset groups, and adds comprehensive functional test coverage for theqr()pipeline.Why
Calling
$parser->qron any pattern with(?|...)died with "Can't locate object method 'on' via package 'Regexp::Parser::branch_reset'". This broke a primary consumer API for branch reset patterns.How
The bug:
Parser.pm:251checkedfamily eq 'group'to detect non-capturing groups and extract their flag modifiers.branch_resetalso hasfamily => 'group'but noon()/off()methods (it has no flags). Changed totype eq 'group'which only matches the non-capturing group construct that actually carries flags.The tests: Added
t/18qr_functional.t— 86 tests that verify the full pipeline (parse → tree → qr → match) across all major construct types: literals, anchors, quantifiers (including possessive), character classes, flags, caret flags, lookahead/behind, atomic groups, named captures, branch reset, backtracking verbs,\K, script runs, quotemeta, Unicode properties, POSIX classes,\R/\h/\v/\X, conditionals, and escape sequences. Previouslyqr()was only tested incidentally in ~5 files.Testing
All 1241 tests pass (1155 existing + 86 new).
🤖 Generated with Claude Code
Quality Report
Changes: 4 files changed, 201 insertions(+), 1 deletion(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline