aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/composer/pcre/preg.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-17 04:44:51 +0900
committernsfisis <nsfisis@gmail.com>2026-05-17 04:57:23 +0900
commit90b3be462bd2f91ef366df06c2b5bbae2821a394 (patch)
tree06fa0e79b4437619ab59718566c2e632c4c9df89 /crates/shirabe-external-packages/src/composer/pcre/preg.rs
parent8d6dbf51af859ad0017ed8d1358824d9386d48c8 (diff)
downloadphp-shirabe-90b3be462bd2f91ef366df06c2b5bbae2821a394.tar.gz
php-shirabe-90b3be462bd2f91ef366df06c2b5bbae2821a394.tar.zst
php-shirabe-90b3be462bd2f91ef366df06c2b5bbae2821a394.zip
fix(class-map-generator): introduce CaptureKey enum and fix class-map-generator compile errors
- Add CaptureKey enum to Preg stub for typed capture access (by index or name) - Expand Preg stub with complete method set matching the PHP Composer\Pcre\Preg API - Update class-map-generator, php-file-cleaner, and php-file-parser to use new API - Add Display impls for exception types in shirabe-php-shim - Add follow_links/exclude stubs to Finder and new/get_pathname stubs to SplFileInfo Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/composer/pcre/preg.rs')
-rw-r--r--crates/shirabe-external-packages/src/composer/pcre/preg.rs497
1 files changed, 472 insertions, 25 deletions
diff --git a/crates/shirabe-external-packages/src/composer/pcre/preg.rs b/crates/shirabe-external-packages/src/composer/pcre/preg.rs
index 2f675cd..3dd8b4f 100644
--- a/crates/shirabe-external-packages/src/composer/pcre/preg.rs
+++ b/crates/shirabe-external-packages/src/composer/pcre/preg.rs
@@ -1,10 +1,190 @@
-use indexmap::IndexMap;
-
#[derive(Debug)]
pub struct Preg;
impl Preg {
- pub fn is_match(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ pub fn r#match(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_strict_groups(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_strict_groups3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_strict_groups4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_strict_groups5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_with_offsets(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_with_offsets3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_with_offsets4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_with_offsets5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn match_all(pattern: &str, subject: &str) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ ) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ flags: i64,
+ ) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all_strict_groups(pattern: &str, subject: &str) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all_strict_groups3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ ) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all_strict_groups4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ flags: i64,
+ ) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all_strict_groups5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all_with_offsets(pattern: &str, subject: &str) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all_with_offsets3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>,
+ ) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all_with_offsets4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>,
+ flags: i64,
+ ) -> anyhow::Result<usize> {
+ todo!()
+ }
+
+ pub fn match_all_with_offsets5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<usize> {
todo!()
}
@@ -12,18 +192,93 @@ impl Preg {
todo!()
}
- pub fn replace_callback<F>(pattern: &str, callback: F, subject: &str) -> anyhow::Result<String>
- where
- F: Fn(&IndexMap<String, String>) -> String,
- {
+ pub fn replace4(
+ pattern: &str,
+ replacement: &str,
+ subject: &str,
+ limit: i64,
+ ) -> anyhow::Result<String> {
todo!()
}
- pub fn replace_with_count(
+ pub fn replace5(
pattern: &str,
replacement: &str,
subject: &str,
- count: &mut i64,
+ limit: i64,
+ count: &mut usize,
+ ) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ pub fn replace_callback<F: Fn(&indexmap::IndexMap<CaptureKey, String>) -> String>(
+ pattern: &str,
+ replacement: F,
+ subject: &str,
+ ) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ pub fn replace_callback4<F: Fn(&indexmap::IndexMap<CaptureKey, String>) -> String>(
+ pattern: &str,
+ replacement: F,
+ subject: &str,
+ limit: i64,
+ ) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ pub fn replace_callback5<F: Fn(&indexmap::IndexMap<CaptureKey, String>) -> String>(
+ pattern: &str,
+ replacement: F,
+ subject: &str,
+ limit: i64,
+ count: &mut usize,
+ ) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ pub fn replace_callback6<F: Fn(&indexmap::IndexMap<CaptureKey, String>) -> String>(
+ pattern: &str,
+ replacement: F,
+ subject: &str,
+ limit: i64,
+ count: Option<&mut usize>,
+ flags: i64,
+ ) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ pub fn replace_callback_array(
+ pattern: &indexmap::IndexMap<String, String>,
+ subject: &str,
+ ) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ pub fn replace_callback_array3(
+ pattern: &indexmap::IndexMap<String, String>,
+ subject: &str,
+ limit: i64,
+ ) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ pub fn replace_callback_array4(
+ pattern: &indexmap::IndexMap<String, String>,
+ subject: &str,
+ limit: i64,
+ count: &mut usize,
+ ) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ pub fn replace_callback_array5(
+ pattern: &indexmap::IndexMap<String, String>,
+ subject: &str,
+ limit: i64,
+ count: Option<&mut usize>,
+ flags: i64,
) -> anyhow::Result<String> {
todo!()
}
@@ -32,48 +287,240 @@ impl Preg {
todo!()
}
- pub fn grep(pattern: &str, input: Vec<String>) -> anyhow::Result<Vec<String>> {
+ pub fn split3(pattern: &str, subject: &str, limit: i64) -> anyhow::Result<Vec<String>> {
+ todo!()
+ }
+
+ pub fn split4(
+ pattern: &str,
+ subject: &str,
+ limit: i64,
+ flags: i64,
+ ) -> anyhow::Result<Vec<String>> {
+ todo!()
+ }
+
+ pub fn split_with_offsets(
+ pattern: &str,
+ subject: &str,
+ ) -> anyhow::Result<Vec<(String, usize)>> {
+ todo!()
+ }
+
+ pub fn split_with_offsets3(
+ pattern: &str,
+ subject: &str,
+ limit: i64,
+ ) -> anyhow::Result<Vec<(String, usize)>> {
+ todo!()
+ }
+
+ pub fn split_with_offsets4(
+ pattern: &str,
+ subject: &str,
+ limit: i64,
+ flags: i64,
+ ) -> anyhow::Result<Vec<(String, usize)>> {
+ todo!()
+ }
+
+ pub fn grep(pattern: &str, array: &[&str]) -> anyhow::Result<Vec<String>> {
+ todo!()
+ }
+
+ pub fn grep3(pattern: &str, array: &[&str], flags: i64) -> anyhow::Result<Vec<String>> {
+ todo!()
+ }
+
+ pub fn is_match(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_strict_groups(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_strict_groups3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_strict_groups4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
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>> {
+ pub fn is_match_strict_groups5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<bool> {
todo!()
}
- /// Returns named captures in an IndexMap.
- pub fn is_match_named(
+ pub fn is_match_with_offsets(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_with_offsets3(
pattern: &str,
subject: &str,
- matches: &mut IndexMap<String, String>,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>,
) -> 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>>> {
+ pub fn is_match_with_offsets4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
todo!()
}
- /// Returns captures with byte offsets: IndexMap<group_name, Vec<(match_str, offset)>>.
- pub fn is_match_all_with_offsets(
+ pub fn is_match_with_offsets5(
pattern: &str,
subject: &str,
- matches: &mut IndexMap<String, Vec<(String, i64)>>,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>,
+ flags: i64,
+ offset: usize,
) -> anyhow::Result<bool> {
todo!()
}
- /// Returns indexed captures as Vec (index 0 = full match) when pattern matches.
- pub fn is_match_with_indexed_captures(
+ pub fn is_match_all(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all3(
pattern: &str,
subject: &str,
- ) -> anyhow::Result<Option<Vec<String>>> {
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<bool> {
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>> {
+ pub fn is_match_all_strict_groups(pattern: &str, subject: &str) -> anyhow::Result<bool> {
todo!()
}
+
+ pub fn is_match_all_strict_groups3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all_strict_groups4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all_strict_groups5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all_with_offsets(pattern: &str, subject: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all_with_offsets3(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all_with_offsets4(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>,
+ flags: i64,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ pub fn is_match_all_with_offsets5(
+ pattern: &str,
+ subject: &str,
+ matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>,
+ flags: i64,
+ offset: usize,
+ ) -> anyhow::Result<bool> {
+ todo!()
+ }
+}
+
+#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
+pub enum CaptureKey {
+ ByIndex(usize),
+ ByName(String),
}