ib_matcher/syntax/mod.rs
1/*!
2A collection of syntax parsers for either [`IbMatcher`](crate::matcher::IbMatcher) or [`regex`](crate::regex) engines.
3
4## glob()-style pattern matching syntax
5See [`glob`] for details. For example:
6```
7// cargo add ib-matcher --features syntax-glob,regex
8use ib_matcher::{regex::lita::Regex, syntax::glob::{parse_wildcard_path, PathSeparator}};
9
10let re = Regex::builder()
11 .build_from_hir(
12 parse_wildcard_path()
13 .separator(PathSeparator::Windows)
14 .call(r"Win*\*\*.exe"),
15 )
16 .unwrap();
17assert!(re.is_match(r"C:\Windows\System32\notepad.exe"));
18```
19
20## IbEverythingExt flavour
21Parse a pattern according to the syntax used by [IbEverythingExt](https://github.com/Chaoses-Ib/IbEverythingExt).
22
23See [`ev`] for details.
24
25### Example
26```
27// cargo add ib-matcher --features syntax-ev,pinyin
28use ib_matcher::{matcher::{IbMatcher, PinyinMatchConfig, pattern::Pattern}, pinyin::PinyinNotation};
29
30let matcher = IbMatcher::builder(Pattern::parse_ev("pinyin;py").call())
31 .pinyin(PinyinMatchConfig::notations(PinyinNotation::Ascii))
32 .build();
33assert!(matcher.is_match("拼音搜索"));
34assert!(matcher.is_match("pinyin") == false);
35```
36
37## Regular expression
38See [`regex`] for details.
39*/
40
41#[cfg(feature = "syntax-glob")]
42pub mod glob;
43
44#[cfg(feature = "syntax-ev")]
45pub mod ev;
46
47#[cfg(feature = "syntax-regex")]
48pub mod regex;