From 7f606f36fef0c0467c3c0db3d0da33af486dae8a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 17 May 2026 02:25:52 +0900 Subject: feat(port): add stub implementations of shirabe-external-packages --- .../src/composer/pcre/mod.rs | 1 + .../src/composer/pcre/preg.rs | 88 ++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 crates/shirabe-external-packages/src/composer/pcre/mod.rs create mode 100644 crates/shirabe-external-packages/src/composer/pcre/preg.rs (limited to 'crates/shirabe-external-packages/src/composer/pcre') diff --git a/crates/shirabe-external-packages/src/composer/pcre/mod.rs b/crates/shirabe-external-packages/src/composer/pcre/mod.rs new file mode 100644 index 0000000..5cc1656 --- /dev/null +++ b/crates/shirabe-external-packages/src/composer/pcre/mod.rs @@ -0,0 +1 @@ +pub mod preg; 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 { + todo!() + } + + pub fn replace(pattern: &str, replacement: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn replace_callback(pattern: &str, callback: F, subject: &str) -> anyhow::Result + where + F: Fn(&IndexMap) -> String, + { + todo!() + } + + pub fn replace_with_count( + pattern: &str, + replacement: &str, + subject: &str, + count: &mut i64, + ) -> anyhow::Result { + todo!() + } + + pub fn split(pattern: &str, subject: &str) -> anyhow::Result> { + todo!() + } + + pub fn grep(pattern: &str, input: Vec) -> anyhow::Result> { + 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> { + todo!() + } + + /// Returns named captures in an IndexMap. + pub fn is_match_named( + pattern: &str, + subject: &str, + matches: &mut IndexMap, + ) -> anyhow::Result { + 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>> { + todo!() + } + + /// Returns captures with byte offsets: IndexMap>. + pub fn is_match_all_with_offsets( + pattern: &str, + subject: &str, + matches: &mut IndexMap>, + ) -> anyhow::Result { + 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>> { + todo!() + } + + /// Like is_match_strict_groups but returns named captures as IndexMap. + pub fn match_strict_groups( + pattern: &str, + subject: &str, + ) -> Option> { + todo!() + } +} -- cgit v1.3.1