diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-17 02:25:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-17 02:25:52 +0900 |
| commit | 7f606f36fef0c0467c3c0db3d0da33af486dae8a (patch) | |
| tree | c3f0a3340e1dbfc5245964a775b73030d5abf44e /crates/shirabe-external-packages/src/composer/pcre/preg.rs | |
| parent | 9389ddbf06f6d38445c277640cab7b2270057790 (diff) | |
| download | php-shirabe-7f606f36fef0c0467c3c0db3d0da33af486dae8a.tar.gz php-shirabe-7f606f36fef0c0467c3c0db3d0da33af486dae8a.tar.zst php-shirabe-7f606f36fef0c0467c3c0db3d0da33af486dae8a.zip | |
feat(port): add stub implementations of shirabe-external-packages
Diffstat (limited to 'crates/shirabe-external-packages/src/composer/pcre/preg.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/composer/pcre/preg.rs | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/crates/shirabe-external-packages/src/composer/pcre/preg.rs b/crates/shirabe-external-packages/src/composer/pcre/preg.rs new file mode 100644 index 0000000..1b2d675 --- /dev/null +++ b/crates/shirabe-external-packages/src/composer/pcre/preg.rs @@ -0,0 +1,88 @@ +use indexmap::IndexMap; + +#[derive(Debug)] +pub struct Preg; + +impl Preg { + pub fn is_match(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn replace(pattern: &str, replacement: &str, subject: &str) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback<F>(pattern: &str, callback: F, subject: &str) -> anyhow::Result<String> + where + F: Fn(&IndexMap<String, String>) -> String, + { + todo!() + } + + pub fn replace_with_count( + pattern: &str, + replacement: &str, + subject: &str, + count: &mut i64, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn split(pattern: &str, subject: &str) -> anyhow::Result<Vec<String>> { + todo!() + } + + pub fn grep(pattern: &str, input: Vec<String>) -> anyhow::Result<Vec<String>> { + todo!() + } + + /// Returns captures as a flat Vec indexed by group number (index 0 = full match). + pub fn is_match_strict_groups( + pattern: &str, + subject: &str, + ) -> Option<Vec<String>> { + todo!() + } + + /// Returns named captures in an IndexMap. + pub fn is_match_named( + pattern: &str, + subject: &str, + matches: &mut IndexMap<String, String>, + ) -> anyhow::Result<bool> { + todo!() + } + + /// Returns all matches; outer Vec indexed by group number, inner Vec by match occurrence. + pub fn is_match_all_strict_groups( + pattern: &str, + subject: &str, + ) -> Option<Vec<Vec<String>>> { + todo!() + } + + /// Returns captures with byte offsets: IndexMap<group_name, Vec<(match_str, offset)>>. + pub fn is_match_all_with_offsets( + pattern: &str, + subject: &str, + matches: &mut IndexMap<String, Vec<(String, i64)>>, + ) -> anyhow::Result<bool> { + todo!() + } + + /// Returns indexed captures as Vec (index 0 = full match) when pattern matches. + pub fn is_match_with_indexed_captures( + pattern: &str, + subject: &str, + ) -> anyhow::Result<Option<Vec<String>>> { + todo!() + } + + /// Like is_match_strict_groups but returns named captures as IndexMap. + pub fn match_strict_groups( + pattern: &str, + subject: &str, + ) -> Option<IndexMap<String, String>> { + todo!() + } +} |
