diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-25 13:43:49 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-25 23:47:47 +0900 |
| commit | 4573629d9fc7321171cd8b134e68869950b02045 (patch) | |
| tree | 1c1786537f71c6c61bca5fb0bba90fe1e722eac0 /crates/shirabe/src/package/loader | |
| parent | 8d6b521e0034d1bcba594921ebc4f74e87e5ef46 (diff) | |
| download | php-shirabe-4573629d9fc7321171cd8b134e68869950b02045.tar.gz php-shirabe-4573629d9fc7321171cd8b134e68869950b02045.tar.zst php-shirabe-4573629d9fc7321171cd8b134e68869950b02045.zip | |
feat(semver): hand-port constraint AND-split to drop look-around regex
The PCRE delimiter `(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)` used to
split AND-constraints relies on look-around, which the regex crate cannot
compile (parse_constraints panicked). Reproduce its semantics in a hand-written
`split_and_constraints` scanner shared by VersionParser and RootPackageLoader.
Also model `method_exists` for the class-name form (shirabe runs no dumped
Composer ClassLoader) and un-ignore the InstalledVersions tests, serialized via
`#[serial]` since they share global static state.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package/loader')
| -rw-r--r-- | crates/shirabe/src/package/loader/root_package_loader.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/crates/shirabe/src/package/loader/root_package_loader.rs b/crates/shirabe/src/package/loader/root_package_loader.rs index 16b905e..9cd1eac 100644 --- a/crates/shirabe/src/package/loader/root_package_loader.rs +++ b/crates/shirabe/src/package/loader/root_package_loader.rs @@ -322,10 +322,7 @@ impl RootPackageLoader { let or_split = Preg::split(r"\s*\|\|?\s*", req_version.trim()); for or_constraint in &or_split { - let and_split = Preg::split( - r"(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)", - or_constraint, - ); + let and_split = shirabe_semver::split_and_constraints(or_constraint); for and_constraint in and_split { constraints.push(and_constraint); } |
