From 704ba2d87733657dea852fa697fc6d23a961a71b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 17 Aug 2026 04:18:59 +0900 Subject: refactor(preg): replace Preg::split*() with shim preg_split*() preg_split2()'s limit was always -1 and its flags were always either 0 or PREG_SPLIT_DELIM_CAPTURE alone, so both arguments are gone: the shim now exposes preg_split() and preg_split_delim_capture() over a shared preg_split_impl(). That leaves Preg::split()/split4() as bare pass-throughs, so callers use the shim functions directly and the wrappers are dropped along with the now-unreferenced PREG_SPLIT_* constants. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/tests/all_functional_test.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/tests/all_functional_test.rs') diff --git a/crates/shirabe/tests/all_functional_test.rs b/crates/shirabe/tests/all_functional_test.rs index 9ca09dc4..7d71c649 100644 --- a/crates/shirabe/tests/all_functional_test.rs +++ b/crates/shirabe/tests/all_functional_test.rs @@ -9,7 +9,7 @@ use indexmap::IndexMap; use serial_test::serial; use shirabe::util::filesystem::Filesystem; use shirabe_pcre::preg::Preg; -use shirabe_php_shim::{CaptureKey, PREG_SPLIT_DELIM_CAPTURE, PhpMixed, intval, php_regex}; +use shirabe_php_shim::{CaptureKey, PhpMixed, intval, php_regex, preg_split_delim_capture}; use std::path::{Path, PathBuf}; /// ref: AllFunctionalTest's `$oldcwd` / `$testDir` instance state plus its `setUp`/`tearDown`. @@ -66,12 +66,7 @@ fn unique_tmp_directory() -> PathBuf { // ref: AllFunctionalTest::parseTestFile fn parse_test_file(file: &Path) -> IndexMap { let contents = std::fs::read_to_string(file).unwrap(); - let tokens = Preg::split4( - php_regex!(r"#(?:^|\n*)--([A-Z-]+)--\n#"), - &contents, - -1, - PREG_SPLIT_DELIM_CAPTURE, - ); + let tokens = preg_split_delim_capture(php_regex!(r"#(?:^|\n*)--([A-Z-]+)--\n#"), &contents); let mut data: IndexMap = IndexMap::new(); let mut section: Option = None; -- cgit v1.3.1-4-g156e