aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/shirabe-pcre/src/preg.rs22
-rw-r--r--crates/shirabe-php-shim/src/preg.rs3
2 files changed, 2 insertions, 23 deletions
diff --git a/crates/shirabe-pcre/src/preg.rs b/crates/shirabe-pcre/src/preg.rs
index f45b86df..fb71c63b 100644
--- a/crates/shirabe-pcre/src/preg.rs
+++ b/crates/shirabe-pcre/src/preg.rs
@@ -14,9 +14,8 @@
use indexmap::IndexMap;
pub use shirabe_php_shim::CaptureKey;
use shirabe_php_shim::{
- PREG_OFFSET_CAPTURE, PREG_SET_ORDER, PREG_UNMATCHED_AS_NULL, PregPattern, preg_grep,
- preg_match_all_offset_capture, preg_match_all2, preg_match2, preg_replace_callback,
- preg_replace2,
+ PREG_UNMATCHED_AS_NULL, PregPattern, preg_grep, preg_match_all_offset_capture, preg_match_all2,
+ preg_match2, preg_replace_callback, preg_replace2,
};
#[derive(Debug)]
@@ -38,8 +37,6 @@ impl Preg {
flags: i64,
offset: usize,
) -> bool {
- Self::check_offset_capture(flags, "matchWithOffsets");
-
let mut internal: IndexMap<CaptureKey, Option<String>> = IndexMap::new();
let result = preg_match2(
pattern,
@@ -216,21 +213,6 @@ impl Preg {
) -> bool {
Self::match_all_with_offsets5(pattern, subject, matches) > 0
}
-
- fn check_offset_capture(flags: i64, use_function_name: &str) {
- assert!(
- flags & PREG_OFFSET_CAPTURE == 0,
- "PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use {}() instead",
- use_function_name
- );
- }
-
- fn check_set_order(flags: i64) {
- assert!(
- flags & PREG_SET_ORDER == 0,
- "PREG_SET_ORDER is not supported as it changes the type of $matches"
- );
- }
}
// Drops `null` (unmatched) groups, mirroring how the public `string`-valued
diff --git a/crates/shirabe-php-shim/src/preg.rs b/crates/shirabe-php-shim/src/preg.rs
index 6d70c717..62ad464c 100644
--- a/crates/shirabe-php-shim/src/preg.rs
+++ b/crates/shirabe-php-shim/src/preg.rs
@@ -1,9 +1,6 @@
use indexmap::IndexMap;
use std::sync::{Arc, LazyLock, Mutex};
-pub const PREG_PATTERN_ORDER: i64 = 1;
-pub const PREG_SET_ORDER: i64 = 2;
-pub const PREG_OFFSET_CAPTURE: i64 = 256;
pub const PREG_UNMATCHED_AS_NULL: i64 = 512;
#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]