fix: reject empty \p{} and \P{} Unicode property names#47
Draft
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
fix: reject empty \p{} and \P{} Unicode property names#47toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
Perl rejects \p{}, \P{}, \p{^}, and \p{ } as "Empty \p{}" at compile
time, but the parser was accepting these patterns silently. Added
validation after braced content extraction to reject empty, caret-only,
and whitespace-only property names using the existing RPe_EMPTYB error
code. Works in both regular and character class contexts.
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
Parser now rejects
\p{},\P{},\p{^}, and\p{ }with the existingRPe_EMPTYBerror, matching Perl's behavior.Why
Perl rejects these at compile time with "Empty \p{}" but the parser accepted them silently, allowing invalid patterns through the validation layer.
How
Added a post-extraction check in both
\pand\Phandlers: after parsing braced content{...}, the property name is validated to be non-empty, not whitespace-only, and not just a^prefix. Uses the existingRPe_EMPTYBerror code. Works in both regular and[...]character class contexts.Testing
t/11errors.tcovering\p{},\P{},\p{^},\p{ }, and character class variants\p{Lu}and\p{^Lu}continue to work🤖 Generated with Claude Code