artichoke_backend/
regexp.rs1use crate::Artichoke;
2use crate::core::Regexp;
3use crate::ffi::InterpreterExtractError;
4
5#[cfg_attr(docsrs, doc(cfg(feature = "core-regexp")))]
6impl Regexp for Artichoke {
7 type Error = InterpreterExtractError;
8
9 fn capture_group_globals(&self) -> Result<usize, Self::Error> {
10 let state = self.state.as_deref().ok_or_else(InterpreterExtractError::new)?;
11 let count = state.regexp.capture_group_globals();
12 Ok(count)
13 }
14
15 fn set_capture_group_globals(&mut self, count: usize) -> Result<(), Self::Error> {
16 let state = self.state.as_deref_mut().ok_or_else(InterpreterExtractError::new)?;
17 state.regexp.set_capture_group_globals(count);
18 Ok(())
19 }
20
21 fn clear_regexp(&mut self) -> Result<(), Self::Error> {
22 let state = self.state.as_deref_mut().ok_or_else(InterpreterExtractError::new)?;
23 state.regexp.clear();
24 Ok(())
25 }
26}