mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
pcre2: add a few re-exports
This adds the top-level is_jit_available and version free functions from the underlying pcre2 crate, and also forwards the max_jit_stack_size option.
This commit is contained in:
parent
f3646242cc
commit
a9d71a0368
@ -10,6 +10,7 @@ extern crate pcre2;
|
|||||||
|
|
||||||
pub use error::{Error, ErrorKind};
|
pub use error::{Error, ErrorKind};
|
||||||
pub use matcher::{RegexCaptures, RegexMatcher, RegexMatcherBuilder};
|
pub use matcher::{RegexCaptures, RegexMatcher, RegexMatcherBuilder};
|
||||||
|
pub use pcre2::{is_jit_available, version};
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
mod matcher;
|
mod matcher;
|
||||||
|
@ -227,6 +227,27 @@ impl RegexMatcherBuilder {
|
|||||||
self.builder.jit_if_available(yes);
|
self.builder.jit_if_available(yes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set the maximum size of PCRE2's JIT stack, in bytes. If the JIT is
|
||||||
|
/// not enabled, then this has no effect.
|
||||||
|
///
|
||||||
|
/// When `None` is given, no custom JIT stack will be created, and instead,
|
||||||
|
/// the default JIT stack is used. When the default is used, its maximum
|
||||||
|
/// size is 32 KB.
|
||||||
|
///
|
||||||
|
/// When this is set, then a new JIT stack will be created with the given
|
||||||
|
/// maximum size as its limit.
|
||||||
|
///
|
||||||
|
/// Increasing the stack size can be useful for larger regular expressions.
|
||||||
|
///
|
||||||
|
/// By default, this is set to `None`.
|
||||||
|
pub fn max_jit_stack_size(
|
||||||
|
&mut self,
|
||||||
|
bytes: Option<usize>,
|
||||||
|
) -> &mut RegexMatcherBuilder {
|
||||||
|
self.builder.max_jit_stack_size(bytes);
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An implementation of the `Matcher` trait using PCRE2.
|
/// An implementation of the `Matcher` trait using PCRE2.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user