aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/composer/pcre/preg.rs
blob: 1b2d6751e0114b50942473159c684de74138a6e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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!()
    }
}