ct_regex_internal/codegen/create_type/
config.rs1use regex_syntax::ast::parse::ParserBuilder;
2use regex_syntax::hir::translate::TranslatorBuilder;
3
4#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ConfigExt {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "ConfigExt",
"ast", &self.ast, "hir", &self.hir, "complex_classes",
&&self.complex_classes)
}
}Debug, #[automatically_derived]
impl ::core::default::Default for ConfigExt {
#[inline]
fn default() -> ConfigExt {
ConfigExt {
ast: ::core::default::Default::default(),
hir: ::core::default::Default::default(),
complex_classes: ::core::default::Default::default(),
}
}
}Default, #[automatically_derived]
impl ::core::clone::Clone for ConfigExt {
#[inline]
fn clone(&self) -> ConfigExt {
ConfigExt {
ast: ::core::clone::Clone::clone(&self.ast),
hir: ::core::clone::Clone::clone(&self.hir),
complex_classes: ::core::clone::Clone::clone(&self.complex_classes),
}
}
}Clone)]
5pub(crate) struct ConfigExt {
6 pub ast: ParserBuilder,
7 pub hir: TranslatorBuilder,
8 pub complex_classes: bool,
9}
10
11macro_rules! impl_hir_methods {
12 ($name:ident) => {
13 pub fn $name(&mut self, flag: bool) -> &mut Self {
14 self.hir.$name(flag);
15 self
16 }
17 };
18 ($name:ident, $($others:ident),+) => {
19 impl_hir_methods! { $name }
20 impl_hir_methods! { $($others),+ }
21 };
22}
23
24impl ConfigExt {
25 self
bool
flag
&mut Self
self.hir.utf8(flag);
self;impl_hir_methods! {
26 case_insensitive,
27 multi_line,
28 dot_matches_new_line,
29 crlf,
30 swap_greed,
31 unicode,
32 utf8
33 }
34
35 pub fn ignore_whitespace(&mut self, flag: bool) -> &mut Self {
36 self.ast.ignore_whitespace(flag);
37 self
38 }
39
40 pub fn complex_classes(&mut self, flag: bool) -> &mut Self {
41 self.complex_classes = flag;
42 self
43 }
44}