Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
withdrawing for now to put more thought into this as testing found out scenarios in which this isn't the proper solution |
MachineInput.StringInput.index() jumps to raw String.indexOf hits; a hit on the low half of a well-formed surrogate pair is not a codepoint boundary -- skip it and keep searching. An explicitly given search start is honored as-is: Matcher.find(int) handed a pair-interior position matches AT it (java.util.regex parity), so only hits strictly beyond the start are scan hits subject to the boundary rule. Adds SurrogatePairTest: no scan match starts inside a well-formed pair regardless of pattern shape (literal / class / alternation -- previously the result depended on whether the pattern compiled to a singleton literal prefix, a monotonicity violation); search resumes past skipped interior hits; lone surrogates at real boundaries still match; explicit interior starts are honored; supplementary matching unchanged.
dfea17f to
420ec9c
Compare
|
Reopening — the withdrawal note said testing had found scenarios where the original fix was not the proper solution; those are now addressed on the rebuilt branch. What was wrong with the original patch: it skipped every pair-interior What changed (branch rebuilt on current master, commit 420ec9c):
Verified locally with Disclosure (as in #207): the patch and tests were composed agentically with GLM 5.3 assistance; all verification above was run locally by me. |
Fixes #207.
MachineInput.StringInput.index()jumps to rawindexOfhits; a hit on the low half of a well-formed surrogate pair is not a codepoint boundary — skip it and keep searching. An explicitly given search start is honored as-is:Matcher.find(int)handed a pair-interior position matches AT it (java.util.regex parity), so only hits strictly beyond the start are scan hits subject to the boundary rule.Adds
SurrogatePairTest: no scan match starts inside a well-formed pair regardless of pattern shape (literal / class / alternation — previously the result depended on whether the pattern compiled to a singleton literal prefix, a monotonicity violation); search resumes past skipped interior hits; lone surrogates at real boundaries still match; explicit interior starts are honored; supplementary matching unchanged.Disclosure: patch and tests composed agentically with GLM 5.3 assistance, as noted in #207; verified locally with
./gradlew checkon JDK 8 (1832 tests, 0 failures, format/license gates green).