fix: minus operator no longer splits namespaced words - #429
Draft
toddr-bot wants to merge 2 commits into
Draft
Conversation
Add TODO-marked regression tests for GitHub #59 / RT #30037 where a minus before a namespaced function name causes it to split into two Word tokens (e.g. -xx::cc becomes -xx + ::cc instead of one token). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The DashedWord tokenizer used \G(\w+) which only matched word characters, causing -xx::cc to split into two tokens (-xx and ::cc). Updated the regex to match Word.pm's pattern: \G(\w+(?:(?:\'|::)\w+)*(?:::)?) which also captures :: and ' namespace separators. Fixes #59 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.
Summary
When PPI parsed
$a=-xx::cc(), the DashedWord tokenizer only captured\w+characters, missing::namespace separators. This caused-xx::ccto be split into two Word tokens (-xxand::cc) instead of remaining a single token.Updated the DashedWord regex to match Word.pm's pattern, which also captures
::and'namespace separators.Fixes #59
Changes
DashedWord.pm__TOKENIZER__on_charregex from\G(\w+)to\G(\w+(?:(?:\'|::)\w+)*(?:::)?)to capture namespace separators-xx::cc(),-foo::bar, and-foo'barTest plan
t/08_regression.tverify all three cases produce single Word tokensGenerated by Kōan /fix
Quality Report
Changes: 2 files changed, 26 insertions(+), 2 deletions(-)
Code scan: clean
Tests: skipped
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline