feat: add {,n} quantifier and fix \p{^Name} negation#35
Draft
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
feat: add {,n} quantifier and fix \p{^Name} negation#35toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
Two parsing fixes:
1. {,n} quantifier syntax (Perl 5.34+): upper bound only with implicit
min=0. Previously treated as literal text. Normalizes to {0,n} in
visual output. Supports lazy ({,n}?) and possessive ({,n}+) modifiers.
2. \p{^Name} caret negation: the ^ prefix inside \p{} is equivalent to
\P{Name} but the parser was storing "^Name" as the type with neg=0.
Now correctly strips ^ and sets neg=1, normalizing to \P{Name}.
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
Add support for
{,n}quantifier syntax (Perl 5.34+) and fix\p{^Name}property negation handling.Why
Two parsing gaps where the module diverges from Perl's actual behavior:
{,n}quantifier — Perl 5.34 added{,n}as shorthand for{0,n}. The parser was treating it as literal text because the handler's regex required at least one digit before the comma.\p{^Name}negation — Perl allows^inside\p{}to negate, equivalent to\P{Name}. The parser was storing^Nameas the type withneg=0, making the negation invisible to programmatic consumers.How
{handler for,\d+\}pattern, defaulting min to 0. Visual output normalizes to{0,n}.^stripping in the\phandler withneg=1flag. Visual normalizes to\P{Name}.Both normalizations are consistent with existing parser behavior (e.g.,
(?P<name>)normalizes to(?<name>)).Testing
t/18quantprop.twith 11 subtests covering: basic parsing, different values, lazy/possessive modifiers, groups/classes, round-trips, edge cases, character class context, and\p{^X}vs\P{X}equivalence.🤖 Generated with Claude Code
Quality Report
Changes: 3 files changed, 156 insertions(+), 2 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline