temper_std/regex/
mod.rs

1use temper_core::AnyValueTrait;
2use temper_core::AsAnyValue;
3use temper_core::Pair;
4mod support;
5pub use support::*;
6pub (crate) fn init() -> temper_core::Result<()> {
7    static INIT_ONCE: std::sync::OnceLock<temper_core::Result<()>> = std::sync::OnceLock::new();
8    INIT_ONCE.get_or_init(| |{
9            CODES__AMPERSAND.set(38).unwrap_or_else(| _ | panic!());
10            CODES__BACKSLASH.set(92).unwrap_or_else(| _ | panic!());
11            CODES__CARET.set(94).unwrap_or_else(| _ | panic!());
12            CODES__CARRIAGE_RETURN.set(13).unwrap_or_else(| _ | panic!());
13            CODES__CURLY_LEFT.set(123).unwrap_or_else(| _ | panic!());
14            CODES__CURLY_RIGHT.set(125).unwrap_or_else(| _ | panic!());
15            CODES__DASH.set(45).unwrap_or_else(| _ | panic!());
16            CODES__DOT.set(46).unwrap_or_else(| _ | panic!());
17            CODES__HIGH_CONTROL_MIN.set(127).unwrap_or_else(| _ | panic!());
18            CODES__HIGH_CONTROL_MAX.set(159).unwrap_or_else(| _ | panic!());
19            CODES__DIGIT0.set(48).unwrap_or_else(| _ | panic!());
20            CODES__DIGIT9.set(57).unwrap_or_else(| _ | panic!());
21            CODES__LOWER_A.set(97).unwrap_or_else(| _ | panic!());
22            CODES__LOWER_Z.set(122).unwrap_or_else(| _ | panic!());
23            CODES__NEWLINE.set(10).unwrap_or_else(| _ | panic!());
24            CODES__PESO.set(36).unwrap_or_else(| _ | panic!());
25            CODES__PIPE.set(124).unwrap_or_else(| _ | panic!());
26            CODES__PLUS.set(43).unwrap_or_else(| _ | panic!());
27            CODES__QUESTION.set(63).unwrap_or_else(| _ | panic!());
28            CODES__ROUND_LEFT.set(40).unwrap_or_else(| _ | panic!());
29            CODES__ROUND_RIGHT.set(41).unwrap_or_else(| _ | panic!());
30            CODES__SLASH.set(47).unwrap_or_else(| _ | panic!());
31            CODES__SQUARE_LEFT.set(91).unwrap_or_else(| _ | panic!());
32            CODES__SQUARE_RIGHT.set(93).unwrap_or_else(| _ | panic!());
33            CODES__STAR.set(42).unwrap_or_else(| _ | panic!());
34            CODES__TAB.set(9).unwrap_or_else(| _ | panic!());
35            CODES__TILDE.set(42).unwrap_or_else(| _ | panic!());
36            CODES__UPPER_A.set(65).unwrap_or_else(| _ | panic!());
37            CODES__UPPER_Z.set(90).unwrap_or_else(| _ | panic!());
38            CODES__SPACE.set(32).unwrap_or_else(| _ | panic!());
39            CODES__SURROGATE_MIN.set(55296).unwrap_or_else(| _ | panic!());
40            CODES__SURROGATE_MAX.set(57343).unwrap_or_else(| _ | panic!());
41            CODES__SUPPLEMENTAL_MIN.set(65536).unwrap_or_else(| _ | panic!());
42            CODES__UINT16_MAX.set(65535).unwrap_or_else(| _ | panic!());
43            CODES__UNDERSCORE.set(95).unwrap_or_else(| _ | panic!());
44            BEGIN.set(Special::new(Begin::new())).unwrap_or_else(| _ | panic!());
45            DOT.set(Special::new(Dot::new())).unwrap_or_else(| _ | panic!());
46            END.set(Special::new(End::new())).unwrap_or_else(| _ | panic!());
47            WORD_BOUNDARY.set(Special::new(WordBoundary::new())).unwrap_or_else(| _ | panic!());
48            DIGIT.set(SpecialSet::new(Digit::new())).unwrap_or_else(| _ | panic!());
49            SPACE.set(SpecialSet::new(Space::new())).unwrap_or_else(| _ | panic!());
50            WORD.set(SpecialSet::new(Word::new())).unwrap_or_else(| _ | panic!());
51            let needsNoEscape__164: i32 = 0;
52            let needsSimpleEscape__166: i32 = 2;
53            let needsNumericEscape__165: i32 = 1;
54            ESCAPE_NEEDS.set(buildEscapeNeeds__161()).unwrap_or_else(| _ | panic!());
55            REGEX_REFS.set(RegexRefs::new(None, None, None, None)).unwrap_or_else(| _ | panic!());
56            Ok(())
57    }).clone()
58}
59static BEGIN: std::sync::OnceLock<Special> = std::sync::OnceLock::new();
60pub fn begin() -> Special {
61    ( * BEGIN.get().unwrap()).clone()
62}
63static DOT: std::sync::OnceLock<Special> = std::sync::OnceLock::new();
64pub fn dot() -> Special {
65    ( * DOT.get().unwrap()).clone()
66}
67static END: std::sync::OnceLock<Special> = std::sync::OnceLock::new();
68pub fn end() -> Special {
69    ( * END.get().unwrap()).clone()
70}
71static WORD_BOUNDARY: std::sync::OnceLock<Special> = std::sync::OnceLock::new();
72pub fn word_boundary() -> Special {
73    ( * WORD_BOUNDARY.get().unwrap()).clone()
74}
75static DIGIT: std::sync::OnceLock<SpecialSet> = std::sync::OnceLock::new();
76pub fn digit() -> SpecialSet {
77    ( * DIGIT.get().unwrap()).clone()
78}
79static SPACE: std::sync::OnceLock<SpecialSet> = std::sync::OnceLock::new();
80pub fn space() -> SpecialSet {
81    ( * SPACE.get().unwrap()).clone()
82}
83static WORD: std::sync::OnceLock<SpecialSet> = std::sync::OnceLock::new();
84pub fn word() -> SpecialSet {
85    ( * WORD.get().unwrap()).clone()
86}
87static ESCAPE_NEEDS: std::sync::OnceLock<temper_core::List<i32>> = std::sync::OnceLock::new();
88fn escape_needs() -> temper_core::List<i32> {
89    ( * ESCAPE_NEEDS.get().unwrap()).clone()
90}
91static REGEX_REFS: std::sync::OnceLock<RegexRefs> = std::sync::OnceLock::new();
92fn regex_refs() -> RegexRefs {
93    ( * REGEX_REFS.get().unwrap()).clone()
94}
95pub trait RegexNodeTrait: temper_core::AsAnyValue + temper_core::AnyValueTrait + std::marker::Send + std::marker::Sync {
96    fn clone_boxed(& self) -> RegexNode;
97    fn compiled(& self) -> Regex {
98        return Regex::new(self.clone_boxed());
99    }
100    fn found(& self, text__170: std::sync::Arc<String>) -> bool {
101        return self.compiled().found(text__170.clone());
102    }
103    fn find(& self, text__173: std::sync::Arc<String>) -> temper_core::Result<Match> {
104        let return__84: Match;
105        return__84 = self.compiled().find(text__173.clone(), None) ? ;
106        return Ok(return__84.clone());
107    }
108    fn replace(& self, text__176: std::sync::Arc<String>, format__177: std::sync::Arc<dyn Fn (Match) -> std::sync::Arc<String> + std::marker::Send + std::marker::Sync>) -> std::sync::Arc<String> {
109        return self.compiled().replace(text__176.clone(), format__177.clone());
110    }
111    fn split(& self, text__180: std::sync::Arc<String>) -> temper_core::List<std::sync::Arc<String>> {
112        return self.compiled().split(text__180.clone());
113    }
114}
115#[ derive(Clone)] pub struct RegexNode(std::sync::Arc<dyn RegexNodeTrait>);
116impl RegexNode {
117pub fn new(selfish: impl RegexNodeTrait + 'static) -> RegexNode {
118    RegexNode(std::sync::Arc::new(selfish))
119}
120}
121temper_core::impl_any_value_trait_for_interface!(RegexNode);
122impl std::ops::Deref for RegexNode {
123type Target = dyn RegexNodeTrait;
124fn deref(& self) -> & Self::Target {
125    & ( * self.0)
126}
127}
128struct CaptureStruct {
129name: std::sync::Arc<String>, item: RegexNode
130}
131#[ derive(Clone)] pub struct Capture(std::sync::Arc<CaptureStruct>);
132#[ derive(Clone)] pub struct CaptureBuilder {
133pub name: std::sync::Arc<String>, pub item: RegexNode
134}
135impl CaptureBuilder {
136pub fn build(self) -> Capture {
137    Capture::new(self.name, self.item)
138}
139}
140impl Capture {
141pub fn new(name__185: impl temper_core::ToArcString, item__186: RegexNode) -> Capture {
142    let name__185 = name__185.to_arc_string();
143    let name;
144    let item;
145    name = name__185.clone();
146    item = item__186.clone();
147    let selfish = Capture(std::sync::Arc::new(CaptureStruct {
148                name, item
149    }));
150    return selfish;
151}
152pub fn name(& self) -> std::sync::Arc<String> {
153    return self.0.name.clone();
154}
155pub fn item(& self) -> RegexNode {
156    return self.0.item.clone();
157}
158}
159impl RegexNodeTrait for Capture {
160fn clone_boxed(& self) -> RegexNode {
161    RegexNode::new(self.clone())
162}
163}
164temper_core::impl_any_value_trait!(Capture, [RegexNode]);
165pub trait CodePartTrait: temper_core::AsAnyValue + temper_core::AnyValueTrait + std::marker::Send + std::marker::Sync + RegexNodeTrait {
166fn clone_boxed(& self) -> CodePart;
167}
168#[ derive(Clone)] pub struct CodePart(std::sync::Arc<dyn CodePartTrait>);
169impl CodePart {
170pub fn new(selfish: impl CodePartTrait + 'static) -> CodePart {
171    CodePart(std::sync::Arc::new(selfish))
172}
173}
174temper_core::impl_any_value_trait_for_interface!(CodePart);
175impl std::ops::Deref for CodePart {
176type Target = dyn CodePartTrait;
177fn deref(& self) -> & Self::Target {
178    & ( * self.0)
179}
180}
181struct CodePointsStruct {
182value: std::sync::Arc<String>
183}
184#[ derive(Clone)] pub struct CodePoints(std::sync::Arc<CodePointsStruct>);
185impl CodePoints {
186pub fn new(value__189: impl temper_core::ToArcString) -> CodePoints {
187    let value__189 = value__189.to_arc_string();
188    let value;
189    value = value__189.clone();
190    let selfish = CodePoints(std::sync::Arc::new(CodePointsStruct {
191                value
192    }));
193    return selfish;
194}
195pub fn value(& self) -> std::sync::Arc<String> {
196    return self.0.value.clone();
197}
198}
199impl CodePartTrait for CodePoints {
200fn clone_boxed(& self) -> CodePart {
201    CodePart::new(self.clone())
202}
203}
204impl RegexNodeTrait for CodePoints {
205fn clone_boxed(& self) -> RegexNode {
206    RegexNode::new(self.clone())
207}
208}
209temper_core::impl_any_value_trait!(CodePoints, [CodePart, RegexNode]);
210pub trait SpecialTrait: temper_core::AsAnyValue + temper_core::AnyValueTrait + std::marker::Send + std::marker::Sync + RegexNodeTrait {
211fn clone_boxed(& self) -> Special;
212}
213#[ derive(Clone)] pub struct Special(std::sync::Arc<dyn SpecialTrait>);
214impl Special {
215pub fn new(selfish: impl SpecialTrait + 'static) -> Special {
216    Special(std::sync::Arc::new(selfish))
217}
218}
219temper_core::impl_any_value_trait_for_interface!(Special);
220impl std::ops::Deref for Special {
221type Target = dyn SpecialTrait;
222fn deref(& self) -> & Self::Target {
223    & ( * self.0)
224}
225}
226pub trait SpecialSetTrait: temper_core::AsAnyValue + temper_core::AnyValueTrait + std::marker::Send + std::marker::Sync + CodePartTrait + SpecialTrait {
227fn clone_boxed(& self) -> SpecialSet;
228}
229#[ derive(Clone)] pub struct SpecialSet(std::sync::Arc<dyn SpecialSetTrait>);
230impl SpecialSet {
231pub fn new(selfish: impl SpecialSetTrait + 'static) -> SpecialSet {
232    SpecialSet(std::sync::Arc::new(selfish))
233}
234}
235temper_core::impl_any_value_trait_for_interface!(SpecialSet);
236impl std::ops::Deref for SpecialSet {
237type Target = dyn SpecialSetTrait;
238fn deref(& self) -> & Self::Target {
239    & ( * self.0)
240}
241}
242struct CodeRangeStruct {
243min: i32, max: i32
244}
245#[ derive(Clone)] pub struct CodeRange(std::sync::Arc<CodeRangeStruct>);
246#[ derive(Clone)] pub struct CodeRangeBuilder {
247pub min: i32, pub max: i32
248}
249impl CodeRangeBuilder {
250pub fn build(self) -> CodeRange {
251    CodeRange::new(self.min, self.max)
252}
253}
254impl CodeRange {
255pub fn new(min__200: i32, max__201: i32) -> CodeRange {
256    let min;
257    let max;
258    min = min__200;
259    max = max__201;
260    let selfish = CodeRange(std::sync::Arc::new(CodeRangeStruct {
261                min, max
262    }));
263    return selfish;
264}
265pub fn min(& self) -> i32 {
266    return self.0.min;
267}
268pub fn max(& self) -> i32 {
269    return self.0.max;
270}
271}
272impl CodePartTrait for CodeRange {
273fn clone_boxed(& self) -> CodePart {
274    CodePart::new(self.clone())
275}
276}
277impl RegexNodeTrait for CodeRange {
278fn clone_boxed(& self) -> RegexNode {
279    RegexNode::new(self.clone())
280}
281}
282temper_core::impl_any_value_trait!(CodeRange, [CodePart, RegexNode]);
283struct CodeSetStruct {
284items: temper_core::List<CodePart>, negated: bool
285}
286#[ derive(Clone)] pub struct CodeSet(std::sync::Arc<CodeSetStruct>);
287#[ derive(Clone, Default)] pub struct CodeSetOptions {
288pub negated: Option<bool>
289}
290#[ derive(Clone)] pub struct CodeSetBuilder {
291pub items: temper_core::List<CodePart>
292}
293impl CodeSetBuilder {
294pub fn build(self) -> CodeSet {
295    self.build_with(std::default::Default::default())
296}
297pub fn build_with(self, options: CodeSetOptions) -> CodeSet {
298    CodeSet::new(self.items, options.negated)
299}
300}
301impl CodeSet {
302pub fn new(items__205: impl temper_core::ToList<CodePart>, negated__535: Option<bool>) -> CodeSet {
303    let items__205 = items__205.to_list();
304    let items;
305    let negated;
306    let negated__206: bool;
307    if negated__535.is_none() {
308        negated__206 = false;
309    } else {
310        negated__206 = negated__535.unwrap();
311    }
312    items = items__205.clone();
313    negated = negated__206;
314    let selfish = CodeSet(std::sync::Arc::new(CodeSetStruct {
315                items, negated
316    }));
317    return selfish;
318}
319pub fn items(& self) -> temper_core::List<CodePart> {
320    return self.0.items.clone();
321}
322pub fn negated(& self) -> bool {
323    return self.0.negated;
324}
325}
326impl RegexNodeTrait for CodeSet {
327fn clone_boxed(& self) -> RegexNode {
328    RegexNode::new(self.clone())
329}
330}
331temper_core::impl_any_value_trait!(CodeSet, [RegexNode]);
332struct OrStruct {
333items: temper_core::List<RegexNode>
334}
335#[ derive(Clone)] pub struct Or(std::sync::Arc<OrStruct>);
336impl Or {
337pub fn new(items__209: impl temper_core::ToList<RegexNode>) -> Or {
338    let items__209 = items__209.to_list();
339    let items;
340    items = items__209.clone();
341    let selfish = Or(std::sync::Arc::new(OrStruct {
342                items
343    }));
344    return selfish;
345}
346pub fn items(& self) -> temper_core::List<RegexNode> {
347    return self.0.items.clone();
348}
349}
350impl RegexNodeTrait for Or {
351fn clone_boxed(& self) -> RegexNode {
352    RegexNode::new(self.clone())
353}
354}
355temper_core::impl_any_value_trait!(Or, [RegexNode]);
356struct RepeatStruct {
357item: RegexNode, min: i32, max: Option<i32>, reluctant: bool
358}
359#[ derive(Clone)] pub struct Repeat(std::sync::Arc<RepeatStruct>);
360#[ derive(Clone, Default)] pub struct RepeatOptions {
361pub reluctant: Option<bool>
362}
363#[ derive(Clone)] pub struct RepeatBuilder {
364pub item: RegexNode, pub min: i32, pub max: Option<i32>
365}
366impl RepeatBuilder {
367pub fn build(self) -> Repeat {
368    self.build_with(std::default::Default::default())
369}
370pub fn build_with(self, options: RepeatOptions) -> Repeat {
371    Repeat::new(self.item, self.min, self.max, options.reluctant)
372}
373}
374impl Repeat {
375pub fn new(item__215: RegexNode, min__216: i32, max__217: Option<i32>, reluctant__537: Option<bool>) -> Repeat {
376    let item;
377    let min;
378    let max;
379    let reluctant;
380    let reluctant__218: bool;
381    if reluctant__537.is_none() {
382        reluctant__218 = false;
383    } else {
384        reluctant__218 = reluctant__537.unwrap();
385    }
386    item = item__215.clone();
387    min = min__216;
388    max = max__217;
389    reluctant = reluctant__218;
390    let selfish = Repeat(std::sync::Arc::new(RepeatStruct {
391                item, min, max, reluctant
392    }));
393    return selfish;
394}
395pub fn item(& self) -> RegexNode {
396    return self.0.item.clone();
397}
398pub fn min(& self) -> i32 {
399    return self.0.min;
400}
401pub fn max(& self) -> Option<i32> {
402    return self.0.max;
403}
404pub fn reluctant(& self) -> bool {
405    return self.0.reluctant;
406}
407}
408impl RegexNodeTrait for Repeat {
409fn clone_boxed(& self) -> RegexNode {
410    RegexNode::new(self.clone())
411}
412}
413temper_core::impl_any_value_trait!(Repeat, [RegexNode]);
414struct SequenceStruct {
415items: temper_core::List<RegexNode>
416}
417#[ derive(Clone)] pub struct Sequence(std::sync::Arc<SequenceStruct>);
418impl Sequence {
419pub fn new(items__229: impl temper_core::ToList<RegexNode>) -> Sequence {
420    let items__229 = items__229.to_list();
421    let items;
422    items = items__229.clone();
423    let selfish = Sequence(std::sync::Arc::new(SequenceStruct {
424                items
425    }));
426    return selfish;
427}
428pub fn items(& self) -> temper_core::List<RegexNode> {
429    return self.0.items.clone();
430}
431}
432impl RegexNodeTrait for Sequence {
433fn clone_boxed(& self) -> RegexNode {
434    RegexNode::new(self.clone())
435}
436}
437temper_core::impl_any_value_trait!(Sequence, [RegexNode]);
438struct MatchStruct {
439full: Group, groups: temper_core::Map<std::sync::Arc<String>, Group>
440}
441#[ derive(Clone)] pub struct Match(std::sync::Arc<MatchStruct>);
442#[ derive(Clone)] pub struct MatchBuilder {
443pub full: Group, pub groups: temper_core::Map<std::sync::Arc<String>, Group>
444}
445impl MatchBuilder {
446pub fn build(self) -> Match {
447    Match::new(self.full, self.groups)
448}
449}
450impl Match {
451pub fn new(full__233: Group, groups__234: temper_core::Map<std::sync::Arc<String>, Group>) -> Match {
452    let full;
453    let groups;
454    full = full__233.clone();
455    groups = groups__234.clone();
456    let selfish = Match(std::sync::Arc::new(MatchStruct {
457                full, groups
458    }));
459    return selfish;
460}
461pub fn full(& self) -> Group {
462    return self.0.full.clone();
463}
464pub fn groups(& self) -> temper_core::Map<std::sync::Arc<String>, Group> {
465    return self.0.groups.clone();
466}
467}
468temper_core::impl_any_value_trait!(Match, []);
469struct GroupStruct {
470name: std::sync::Arc<String>, value: std::sync::Arc<String>, begin: usize, end: usize
471}
472#[ derive(Clone)] pub struct Group(std::sync::Arc<GroupStruct>);
473#[ derive(Clone)] pub struct GroupBuilder {
474pub name: std::sync::Arc<String>, pub value: std::sync::Arc<String>, pub begin: usize, pub end: usize
475}
476impl GroupBuilder {
477pub fn build(self) -> Group {
478    Group::new(self.name, self.value, self.begin, self.end)
479}
480}
481impl Group {
482pub fn new(name__240: impl temper_core::ToArcString, value__241: impl temper_core::ToArcString, begin__242: usize, end__243: usize) -> Group {
483    let name__240 = name__240.to_arc_string();
484    let value__241 = value__241.to_arc_string();
485    let name;
486    let value;
487    let begin;
488    let end;
489    name = name__240.clone();
490    value = value__241.clone();
491    begin = begin__242;
492    end = end__243;
493    let selfish = Group(std::sync::Arc::new(GroupStruct {
494                name, value, begin, end
495    }));
496    return selfish;
497}
498pub fn name(& self) -> std::sync::Arc<String> {
499    return self.0.name.clone();
500}
501pub fn value(& self) -> std::sync::Arc<String> {
502    return self.0.value.clone();
503}
504pub fn begin(& self) -> usize {
505    return self.0.begin;
506}
507pub fn end(& self) -> usize {
508    return self.0.end;
509}
510}
511temper_core::impl_any_value_trait!(Group, []);
512struct RegexRefsStruct {
513code_points: CodePoints, group: Group, r#match: Match, or_object: Or
514}
515#[ derive(Clone)] pub (crate) struct RegexRefs(std::sync::Arc<RegexRefsStruct>);
516impl RegexRefs {
517pub fn new(codePoints__539: Option<CodePoints>, group__541: Option<Group>, match__543: Option<Match>, orObject__545: Option<Or>) -> RegexRefs {
518    let code_points;
519    let group;
520    let r#match;
521    let or_object;
522    let mut t___1259: CodePoints;
523    let mut t___1260: Group;
524    let mut t___1262: temper_core::Map<std::sync::Arc<String>, Group>;
525    let mut t___1263: Match;
526    let mut t___1264: Or;
527    let codePoints__249: CodePoints;
528    if codePoints__539.is_none() {
529        t___1259 = CodePoints::new("");
530        codePoints__249 = t___1259.clone();
531    } else {
532        codePoints__249 = codePoints__539.clone().unwrap();
533    }
534    let group__250: Group;
535    if group__541.is_none() {
536        t___1260 = Group::new("", "", 0usize, 0usize);
537        group__250 = t___1260.clone();
538    } else {
539        group__250 = group__541.clone().unwrap();
540    }
541    let match__251: Match;
542    if match__543.is_none() {
543        t___1262 = temper_core::Map::new( & [(std::sync::Arc::new("".to_string()), group__250.clone())]);
544        t___1263 = Match::new(group__250.clone(), t___1262.clone());
545        match__251 = t___1263.clone();
546    } else {
547        match__251 = match__543.clone().unwrap();
548    }
549    let orObject__252: Or;
550    if orObject__545.is_none() {
551        t___1264 = Or::new([]);
552        orObject__252 = t___1264.clone();
553    } else {
554        orObject__252 = orObject__545.clone().unwrap();
555    }
556    code_points = codePoints__249.clone();
557    group = group__250.clone();
558    r#match = match__251.clone();
559    or_object = orObject__252.clone();
560    let selfish = RegexRefs(std::sync::Arc::new(RegexRefsStruct {
561                code_points, group, r#match, or_object
562    }));
563    return selfish;
564}
565pub fn code_points(& self) -> CodePoints {
566    return self.0.code_points.clone();
567}
568pub fn group(& self) -> Group {
569    return self.0.group.clone();
570}
571pub fn r#match(& self) -> Match {
572    return self.0.r#match.clone();
573}
574pub fn or_object(& self) -> Or {
575    return self.0.or_object.clone();
576}
577}
578temper_core::impl_any_value_trait!(RegexRefs, []);
579struct RegexStruct {
580data: RegexNode, compiled: temper_core::AnyValue
581}
582#[ derive(Clone)] pub struct Regex(std::sync::Arc<RegexStruct>);
583impl Regex {
584pub fn new(data__255: RegexNode) -> Regex {
585    let data;
586    let compiled;
587    let t___412: RegexNode = data__255.clone();
588    data = t___412.clone();
589    let formatted__257: std::sync::Arc<String> = RegexFormatter::regex_format(data__255.clone());
590    let mut t___1143: temper_core::AnyValue = compile_formatted( & ( * data__255), formatted__257.clone());
591    compiled = t___1143.clone();
592    let selfish = Regex(std::sync::Arc::new(RegexStruct {
593                data, compiled
594    }));
595    return selfish;
596}
597pub fn found(& self, text__259: impl temper_core::ToArcString) -> bool {
598    let text__259 = text__259.to_arc_string();
599    return compiled_found( & self, self.0.compiled.clone(), text__259.clone());
600}
601pub fn find(& self, text__262: impl temper_core::ToArcString, begin__547: Option<usize>) -> temper_core::Result<Match> {
602    let text__262 = text__262.to_arc_string();
603    let return__131: Match;
604    let begin__263: usize;
605    if begin__547.is_none() {
606        begin__263 = 0usize;
607    } else {
608        begin__263 = begin__547.unwrap();
609    }
610    return__131 = compiled_find( & self, self.0.compiled.clone(), text__262.clone(), begin__263, regex_refs().clone()) ? ;
611    return Ok(return__131.clone());
612}
613pub fn replace(& self, text__266: impl temper_core::ToArcString, format__267: std::sync::Arc<dyn Fn (Match) -> std::sync::Arc<String> + std::marker::Send + std::marker::Sync>) -> std::sync::Arc<String> {
614    let text__266 = text__266.to_arc_string();
615    return compiled_replace( & self, self.0.compiled.clone(), text__266.clone(), & ( * format__267.clone()), regex_refs().clone());
616}
617pub fn split(& self, text__270: impl temper_core::ToArcString) -> temper_core::List<std::sync::Arc<String>> {
618    let text__270 = text__270.to_arc_string();
619    return compiled_split( & self, self.0.compiled.clone(), text__270.clone(), regex_refs().clone());
620}
621pub fn data(& self) -> RegexNode {
622    return self.0.data.clone();
623}
624}
625temper_core::impl_any_value_trait!(Regex, []);
626struct RegexFormatterStruct {
627out: std::sync::Arc<std::sync::RwLock<String>>
628}
629#[ derive(Clone)] pub (crate) struct RegexFormatter(std::sync::Arc<RegexFormatterStruct>);
630impl RegexFormatter {
631pub fn regex_format(data__300: RegexNode) -> std::sync::Arc<String> {
632    return RegexFormatter::new().format(data__300.clone());
633}
634pub fn format(& self, regex__303: RegexNode) -> std::sync::Arc<String> {
635    self.push_regex(regex__303.clone());
636    return temper_core::string::builder::to_string( & self.0.out);
637}
638fn push_regex(& self, regex__306: RegexNode) {
639    let mut t___868: Capture;
640    let mut t___869: CodePoints;
641    let mut t___870: CodeRange;
642    let mut t___871: CodeSet;
643    let mut t___872: Or;
644    let mut t___873: Repeat;
645    let mut t___874: Sequence;
646    if temper_core::is::<Capture>(regex__306.clone()) {
647        t___868 = temper_core::cast::<Capture>(regex__306.clone()).unwrap();
648        self.push_capture(t___868.clone());
649    } else {
650        if temper_core::is::<CodePoints>(regex__306.clone()) {
651            t___869 = temper_core::cast::<CodePoints>(regex__306.clone()).unwrap();
652            self.push_code_points(t___869.clone(), false);
653        } else {
654            if temper_core::is::<CodeRange>(regex__306.clone()) {
655                t___870 = temper_core::cast::<CodeRange>(regex__306.clone()).unwrap();
656                self.push_code_range(t___870.clone());
657            } else {
658                if temper_core::is::<CodeSet>(regex__306.clone()) {
659                    t___871 = temper_core::cast::<CodeSet>(regex__306.clone()).unwrap();
660                    self.push_code_set(t___871.clone());
661                } else {
662                    if temper_core::is::<Or>(regex__306.clone()) {
663                        t___872 = temper_core::cast::<Or>(regex__306.clone()).unwrap();
664                        self.push_or(t___872.clone());
665                    } else {
666                        if temper_core::is::<Repeat>(regex__306.clone()) {
667                            t___873 = temper_core::cast::<Repeat>(regex__306.clone()).unwrap();
668                            self.push_repeat(t___873.clone());
669                        } else {
670                            if temper_core::is::<Sequence>(regex__306.clone()) {
671                                t___874 = temper_core::cast::<Sequence>(regex__306.clone()).unwrap();
672                                self.push_sequence(t___874.clone());
673                            } else {
674                                if regex__306.ptr_id() == begin().ptr_id() {
675                                    temper_core::string::builder::append( & self.0.out, "^");
676                                } else {
677                                    if regex__306.ptr_id() == dot().ptr_id() {
678                                        temper_core::string::builder::append( & self.0.out, ".");
679                                    } else {
680                                        if regex__306.ptr_id() == end().ptr_id() {
681                                            temper_core::string::builder::append( & self.0.out, "$");
682                                        } else {
683                                            if regex__306.ptr_id() == word_boundary().ptr_id() {
684                                                temper_core::string::builder::append( & self.0.out, "\\b");
685                                            } else {
686                                                if regex__306.ptr_id() == digit().ptr_id() {
687                                                    temper_core::string::builder::append( & self.0.out, "\\d");
688                                                } else {
689                                                    if regex__306.ptr_id() == space().ptr_id() {
690                                                        temper_core::string::builder::append( & self.0.out, "\\s");
691                                                    } else {
692                                                        if regex__306.ptr_id() == word().ptr_id() {
693                                                            temper_core::string::builder::append( & self.0.out, "\\w");
694                                                        }
695                                                    }
696                                                }
697                                            }
698                                        }
699                                    }
700                                }
701                            }
702                        }
703                    }
704                }
705            }
706        }
707    }
708}
709fn push_capture(& self, capture__309: Capture) {
710    temper_core::string::builder::append( & self.0.out, "(");
711    let mut t___842: std::sync::Arc<std::sync::RwLock<String>> = self.0.out.clone();
712    let mut t___1229: std::sync::Arc<String> = capture__309.name();
713    self.push_capture_name(t___842.clone(), t___1229.clone());
714    let mut t___1231: RegexNode = capture__309.item();
715    self.push_regex(t___1231.clone());
716    temper_core::string::builder::append( & self.0.out, ")");
717}
718fn push_capture_name(& self, out__312: std::sync::Arc<std::sync::RwLock<String>>, name__313: impl temper_core::ToArcString) {
719    let name__313 = name__313.to_arc_string();
720    temper_core::string::builder::append( & out__312, std::sync::Arc::new(format!("?<{}>", name__313.clone())));
721}
722fn push_code(& self, code__316: i32, insideCodeSet__317: bool) {
723    let return__146: ();
724    let mut t___830: bool;
725    let mut t___831: bool;
726    let mut t___832: std::sync::Arc<String>;
727    let mut t___834: std::sync::Arc<String>;
728    let mut t___835: bool;
729    let mut t___836: bool;
730    let mut t___837: bool;
731    let mut t___838: bool;
732    let mut t___839: std::sync::Arc<String>;
733    'fn__318: {
734        'ok___2611: {
735            'orelse___553: {
736                let specialEscape__319: std::sync::Arc<String>;
737                if Some(code__316) == Some(Codes::carriage_return()) {
738                    specialEscape__319 = std::sync::Arc::new("r".to_string());
739                } else {
740                    if Some(code__316) == Some(Codes::newline()) {
741                        specialEscape__319 = std::sync::Arc::new("n".to_string());
742                    } else {
743                        if Some(code__316) == Some(Codes::tab()) {
744                            specialEscape__319 = std::sync::Arc::new("t".to_string());
745                        } else {
746                            specialEscape__319 = std::sync::Arc::new("".to_string());
747                        }
748                    }
749                }
750                if Some(specialEscape__319.as_str()) != Some("") {
751                    temper_core::string::builder::append( & self.0.out, "\\");
752                    temper_core::string::builder::append( & self.0.out, specialEscape__319.clone());
753                    return__146 = ();
754                    break 'fn__318;
755                }
756                if Some(code__316) <= Some(127) {
757                    let escapeNeed__320: i32 = temper_core::ListedTrait::get( & escape_needs(), code__316);
758                    if Some(escapeNeed__320) == Some(2) {
759                        t___831 = true;
760                    } else {
761                        if insideCodeSet__317 {
762                            t___830 = Some(code__316) == Some(Codes::dash());
763                        } else {
764                            t___830 = false;
765                        }
766                        t___831 = t___830;
767                    }
768                    if t___831 {
769                        temper_core::string::builder::append( & self.0.out, "\\");
770                        t___832 = match temper_core::string::from_code_point(code__316) {
771                            Ok(x) => x,
772                            _ => break 'orelse___553
773                        };
774                        temper_core::string::builder::append( & self.0.out, t___832.clone());
775                        return__146 = ();
776                        break 'fn__318;
777                    } else {
778                        if Some(escapeNeed__320) == Some(0) {
779                            t___834 = match temper_core::string::from_code_point(code__316) {
780                                Ok(x) => x,
781                                _ => break 'orelse___553
782                            };
783                            temper_core::string::builder::append( & self.0.out, t___834.clone());
784                            return__146 = ();
785                            break 'fn__318;
786                        }
787                    }
788                }
789                if Some(code__316) >= Some(Codes::supplemental_min()) {
790                    t___838 = true;
791                } else {
792                    if Some(code__316) > Some(Codes::high_control_max()) {
793                        if Some(Codes::surrogate_min()) <= Some(code__316) {
794                            t___835 = Some(code__316) <= Some(Codes::surrogate_max());
795                        } else {
796                            t___835 = false;
797                        }
798                        if t___835 {
799                            t___836 = true;
800                        } else {
801                            t___836 = Some(code__316) == Some(Codes::uint16_max());
802                        }
803                        t___837 = ! t___836;
804                    } else {
805                        t___837 = false;
806                    }
807                    t___838 = t___837;
808                }
809                if t___838 {
810                    t___839 = match temper_core::string::from_code_point(code__316) {
811                        Ok(x) => x,
812                        _ => break 'orelse___553
813                    };
814                    temper_core::string::builder::append( & self.0.out, t___839.clone());
815                } else {
816                    push_code_to( & self, self.0.out.clone(), code__316, insideCodeSet__317);
817                }
818                break 'ok___2611;
819            }
820            return panic!();
821        }
822        return__146 = ();
823    }
824    return return__146;
825}
826fn push_code_points(& self, codePoints__327: CodePoints, insideCodeSet__328: bool) {
827    let mut t___1216: i32;
828    let mut t___1218: usize;
829    let value__330: std::sync::Arc<String> = codePoints__327.value();
830    let mut index__331: usize = 0usize;
831    'loop___2668: loop {
832        if ! temper_core::string::has_index( & value__330, index__331) {
833            break;
834        }
835        t___1216 = temper_core::string::get( & value__330, index__331);
836        self.push_code(t___1216, insideCodeSet__328);
837        t___1218 = temper_core::string::next( & value__330, index__331);
838        index__331 = t___1218;
839    }
840}
841fn push_code_range(& self, codeRange__333: CodeRange) {
842    temper_core::string::builder::append( & self.0.out, "[");
843    self.push_code_range_unwrapped(codeRange__333.clone());
844    temper_core::string::builder::append( & self.0.out, "]");
845}
846fn push_code_range_unwrapped(& self, codeRange__336: CodeRange) {
847    let mut t___1206: i32 = codeRange__336.min();
848    self.push_code(t___1206, true);
849    temper_core::string::builder::append( & self.0.out, "-");
850    let mut t___1209: i32 = codeRange__336.max();
851    self.push_code(t___1209, true);
852}
853fn push_code_set(& self, codeSet__339: CodeSet) {
854    let mut t___1200: i32;
855    let mut t___1202: CodePart;
856    let mut t___815: CodeSet;
857    let adjusted__341: RegexNode = self.adjust_code_set(codeSet__339.clone(), regex_refs().clone());
858    if temper_core::is::<CodeSet>(adjusted__341.clone()) {
859        t___815 = temper_core::cast::<CodeSet>(adjusted__341.clone()).unwrap();
860        temper_core::string::builder::append( & self.0.out, "[");
861        if t___815.negated() {
862            temper_core::string::builder::append( & self.0.out, "^");
863        }
864        let mut i__342: i32 = 0;
865        'loop___2669: loop {
866            t___1200 = temper_core::ListedTrait::len( & t___815.items());
867            if ! (Some(i__342) < Some(t___1200)) {
868                break;
869            }
870            t___1202 = temper_core::ListedTrait::get( & t___815.items(), i__342);
871            self.push_code_set_item(t___1202.clone());
872            i__342 = i__342.wrapping_add(1);
873        }
874        temper_core::string::builder::append( & self.0.out, "]");
875    } else {
876        self.push_regex(adjusted__341.clone());
877    }
878}
879fn adjust_code_set(& self, codeSet__344: CodeSet, regexRefs__345: RegexRefs) -> RegexNode {
880    return RegexNode::new(codeSet__344.clone());
881}
882fn push_code_set_item(& self, codePart__348: CodePart) {
883    let mut t___803: CodePoints;
884    let mut t___804: CodeRange;
885    let mut t___805: SpecialSet;
886    if temper_core::is::<CodePoints>(codePart__348.clone()) {
887        t___803 = temper_core::cast::<CodePoints>(codePart__348.clone()).unwrap();
888        self.push_code_points(t___803.clone(), true);
889    } else {
890        if temper_core::is::<CodeRange>(codePart__348.clone()) {
891            t___804 = temper_core::cast::<CodeRange>(codePart__348.clone()).unwrap();
892            self.push_code_range_unwrapped(t___804.clone());
893        } else {
894            if temper_core::is::<SpecialSet>(codePart__348.clone()) {
895                t___805 = temper_core::cast::<SpecialSet>(codePart__348.clone()).unwrap();
896                self.push_regex(temper_core::cast::<RegexNode>(t___805.clone()).unwrap());
897            }
898        }
899    }
900}
901fn push_or(& self, or__351: Or) {
902    let mut t___1179: RegexNode;
903    let mut t___1182: i32;
904    let mut t___1185: RegexNode;
905    if ! temper_core::ListedTrait::is_empty( & or__351.items()) {
906        temper_core::string::builder::append( & self.0.out, "(?:");
907        t___1179 = temper_core::ListedTrait::get( & or__351.items(), 0);
908        self.push_regex(t___1179.clone());
909        let mut i__353: i32 = 1;
910        'loop___2670: loop {
911            t___1182 = temper_core::ListedTrait::len( & or__351.items());
912            if ! (Some(i__353) < Some(t___1182)) {
913                break;
914            }
915            temper_core::string::builder::append( & self.0.out, "|");
916            t___1185 = temper_core::ListedTrait::get( & or__351.items(), i__353);
917            self.push_regex(t___1185.clone());
918            i__353 = i__353.wrapping_add(1);
919        }
920        temper_core::string::builder::append( & self.0.out, ")");
921    }
922}
923fn push_repeat(& self, repeat__355: Repeat) {
924    let mut t___1167: std::sync::Arc<String>;
925    let mut t___1170: std::sync::Arc<String>;
926    let mut t___780: bool;
927    let mut t___781: bool;
928    let mut t___782: bool;
929    temper_core::string::builder::append( & self.0.out, "(?:");
930    let mut t___1159: RegexNode = repeat__355.item();
931    self.push_regex(t___1159.clone());
932    temper_core::string::builder::append( & self.0.out, ")");
933    let min__357: i32 = repeat__355.min();
934    let max__358: Option<i32> = repeat__355.max();
935    if Some(min__357) == Some(0) {
936        t___780 = max__358 == Some(1);
937    } else {
938        t___780 = false;
939    }
940    if t___780 {
941        temper_core::string::builder::append( & self.0.out, "?");
942    } else {
943        if Some(min__357) == Some(0) {
944            t___781 = max__358.is_none();
945        } else {
946            t___781 = false;
947        }
948        if t___781 {
949            temper_core::string::builder::append( & self.0.out, "*");
950        } else {
951            if Some(min__357) == Some(1) {
952                t___782 = max__358.is_none();
953            } else {
954                t___782 = false;
955            }
956            if t___782 {
957                temper_core::string::builder::append( & self.0.out, "+");
958            } else {
959                t___1167 = temper_core::int_to_string(min__357, None);
960                temper_core::string::builder::append( & self.0.out, std::sync::Arc::new(format!("{{{}", t___1167.clone())));
961                if Some(min__357) != max__358 {
962                    temper_core::string::builder::append( & self.0.out, ",");
963                    if ! max__358.is_none() {
964                        t___1170 = temper_core::int_to_string(max__358.unwrap(), None);
965                        temper_core::string::builder::append( & self.0.out, t___1170.clone());
966                    }
967                }
968                temper_core::string::builder::append( & self.0.out, "}");
969            }
970        }
971    }
972    if repeat__355.reluctant() {
973        temper_core::string::builder::append( & self.0.out, "?");
974    }
975}
976fn push_sequence(& self, sequence__360: Sequence) {
977    let mut t___1154: i32;
978    let mut t___1156: RegexNode;
979    let mut i__362: i32 = 0;
980    'loop___2674: loop {
981        t___1154 = temper_core::ListedTrait::len( & sequence__360.items());
982        if ! (Some(i__362) < Some(t___1154)) {
983            break;
984        }
985        t___1156 = temper_core::ListedTrait::get( & sequence__360.items(), i__362);
986        self.push_regex(t___1156.clone());
987        i__362 = i__362.wrapping_add(1);
988    }
989}
990pub fn max_code(& self, codePart__364: CodePart) -> Option<i32> {
991    let return__157: Option<i32>;
992    let mut t___1150: usize;
993    let mut t___768: CodePoints;
994    if temper_core::is::<CodePoints>(codePart__364.clone()) {
995        t___768 = temper_core::cast::<CodePoints>(codePart__364.clone()).unwrap();
996        let value__366: std::sync::Arc<String> = t___768.value();
997        if value__366.is_empty() {
998            return__157 = None;
999        } else {
1000            let mut max__367: i32 = 0;
1001            let mut index__368: usize = 0usize;
1002            'loop___2675: loop {
1003                if ! temper_core::string::has_index( & value__366, index__368) {
1004                    break;
1005                }
1006                let next__369: i32 = temper_core::string::get( & value__366, index__368);
1007                if Some(next__369) > Some(max__367) {
1008                    max__367 = next__369;
1009                }
1010                t___1150 = temper_core::string::next( & value__366, index__368);
1011                index__368 = t___1150;
1012            }
1013            return__157 = Some(max__367);
1014        }
1015    } else {
1016        if temper_core::is::<CodeRange>(codePart__364.clone()) {
1017            return__157 = Some(temper_core::cast::<CodeRange>(codePart__364.clone()).unwrap().max());
1018        } else {
1019            if codePart__364.ptr_id() == digit().ptr_id() {
1020                return__157 = Some(Codes::digit9());
1021            } else {
1022                if codePart__364.ptr_id() == space().ptr_id() {
1023                    return__157 = Some(Codes::space());
1024                } else {
1025                    if codePart__364.ptr_id() == word().ptr_id() {
1026                        return__157 = Some(Codes::lower_z());
1027                    } else {
1028                        return__157 = None;
1029                    }
1030                }
1031            }
1032        }
1033    }
1034    return return__157;
1035}
1036pub fn new() -> RegexFormatter {
1037    let out;
1038    let mut t___1144: std::sync::Arc<std::sync::RwLock<String>> = std::sync::Arc::new(std::sync::RwLock::new(String::new()));
1039    out = t___1144.clone();
1040    let selfish = RegexFormatter(std::sync::Arc::new(RegexFormatterStruct {
1041                out
1042    }));
1043    return selfish;
1044}
1045}
1046temper_core::impl_any_value_trait!(RegexFormatter, []);
1047struct CodesStruct {}
1048#[ derive(Clone)] pub (crate) struct Codes(std::sync::Arc<CodesStruct>);
1049static CODES__AMPERSAND: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1050static CODES__BACKSLASH: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1051static CODES__CARET: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1052static CODES__CARRIAGE_RETURN: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1053static CODES__CURLY_LEFT: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1054static CODES__CURLY_RIGHT: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1055static CODES__DASH: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1056static CODES__DOT: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1057static CODES__HIGH_CONTROL_MIN: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1058static CODES__HIGH_CONTROL_MAX: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1059static CODES__DIGIT0: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1060static CODES__DIGIT9: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1061static CODES__LOWER_A: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1062static CODES__LOWER_Z: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1063static CODES__NEWLINE: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1064static CODES__PESO: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1065static CODES__PIPE: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1066static CODES__PLUS: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1067static CODES__QUESTION: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1068static CODES__ROUND_LEFT: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1069static CODES__ROUND_RIGHT: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1070static CODES__SLASH: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1071static CODES__SQUARE_LEFT: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1072static CODES__SQUARE_RIGHT: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1073static CODES__STAR: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1074static CODES__TAB: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1075static CODES__TILDE: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1076static CODES__UPPER_A: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1077static CODES__UPPER_Z: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1078static CODES__SPACE: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1079static CODES__SURROGATE_MIN: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1080static CODES__SURROGATE_MAX: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1081static CODES__SUPPLEMENTAL_MIN: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1082static CODES__UINT16_MAX: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1083static CODES__UNDERSCORE: std::sync::OnceLock<i32> = std::sync::OnceLock::new();
1084impl Codes {
1085pub fn ampersand() -> i32 {
1086    * CODES__AMPERSAND.get().unwrap()
1087}
1088pub fn backslash() -> i32 {
1089    * CODES__BACKSLASH.get().unwrap()
1090}
1091pub fn caret() -> i32 {
1092    * CODES__CARET.get().unwrap()
1093}
1094pub fn carriage_return() -> i32 {
1095    * CODES__CARRIAGE_RETURN.get().unwrap()
1096}
1097pub fn curly_left() -> i32 {
1098    * CODES__CURLY_LEFT.get().unwrap()
1099}
1100pub fn curly_right() -> i32 {
1101    * CODES__CURLY_RIGHT.get().unwrap()
1102}
1103pub fn dash() -> i32 {
1104    * CODES__DASH.get().unwrap()
1105}
1106pub fn dot() -> i32 {
1107    * CODES__DOT.get().unwrap()
1108}
1109pub fn high_control_min() -> i32 {
1110    * CODES__HIGH_CONTROL_MIN.get().unwrap()
1111}
1112pub fn high_control_max() -> i32 {
1113    * CODES__HIGH_CONTROL_MAX.get().unwrap()
1114}
1115pub fn digit0() -> i32 {
1116    * CODES__DIGIT0.get().unwrap()
1117}
1118pub fn digit9() -> i32 {
1119    * CODES__DIGIT9.get().unwrap()
1120}
1121pub fn lower_a() -> i32 {
1122    * CODES__LOWER_A.get().unwrap()
1123}
1124pub fn lower_z() -> i32 {
1125    * CODES__LOWER_Z.get().unwrap()
1126}
1127pub fn newline() -> i32 {
1128    * CODES__NEWLINE.get().unwrap()
1129}
1130pub fn peso() -> i32 {
1131    * CODES__PESO.get().unwrap()
1132}
1133pub fn pipe() -> i32 {
1134    * CODES__PIPE.get().unwrap()
1135}
1136pub fn plus() -> i32 {
1137    * CODES__PLUS.get().unwrap()
1138}
1139pub fn question() -> i32 {
1140    * CODES__QUESTION.get().unwrap()
1141}
1142pub fn round_left() -> i32 {
1143    * CODES__ROUND_LEFT.get().unwrap()
1144}
1145pub fn round_right() -> i32 {
1146    * CODES__ROUND_RIGHT.get().unwrap()
1147}
1148pub fn slash() -> i32 {
1149    * CODES__SLASH.get().unwrap()
1150}
1151pub fn square_left() -> i32 {
1152    * CODES__SQUARE_LEFT.get().unwrap()
1153}
1154pub fn square_right() -> i32 {
1155    * CODES__SQUARE_RIGHT.get().unwrap()
1156}
1157pub fn star() -> i32 {
1158    * CODES__STAR.get().unwrap()
1159}
1160pub fn tab() -> i32 {
1161    * CODES__TAB.get().unwrap()
1162}
1163pub fn tilde() -> i32 {
1164    * CODES__TILDE.get().unwrap()
1165}
1166pub fn upper_a() -> i32 {
1167    * CODES__UPPER_A.get().unwrap()
1168}
1169pub fn upper_z() -> i32 {
1170    * CODES__UPPER_Z.get().unwrap()
1171}
1172pub fn space() -> i32 {
1173    * CODES__SPACE.get().unwrap()
1174}
1175pub fn surrogate_min() -> i32 {
1176    * CODES__SURROGATE_MIN.get().unwrap()
1177}
1178pub fn surrogate_max() -> i32 {
1179    * CODES__SURROGATE_MAX.get().unwrap()
1180}
1181pub fn supplemental_min() -> i32 {
1182    * CODES__SUPPLEMENTAL_MIN.get().unwrap()
1183}
1184pub fn uint16_max() -> i32 {
1185    * CODES__UINT16_MAX.get().unwrap()
1186}
1187pub fn underscore() -> i32 {
1188    * CODES__UNDERSCORE.get().unwrap()
1189}
1190pub fn new() -> Codes {
1191    let selfish = Codes(std::sync::Arc::new(CodesStruct {}));
1192    return selfish;
1193}
1194}
1195temper_core::impl_any_value_trait!(Codes, []);
1196struct BeginStruct {}
1197#[ derive(Clone)] pub (crate) struct Begin(std::sync::Arc<BeginStruct>);
1198impl Begin {
1199pub fn new() -> Begin {
1200    let selfish = Begin(std::sync::Arc::new(BeginStruct {}));
1201    return selfish;
1202}
1203}
1204impl SpecialTrait for Begin {
1205fn clone_boxed(& self) -> Special {
1206    Special::new(self.clone())
1207}
1208}
1209impl RegexNodeTrait for Begin {
1210fn clone_boxed(& self) -> RegexNode {
1211    RegexNode::new(self.clone())
1212}
1213}
1214temper_core::impl_any_value_trait!(Begin, [Special, RegexNode]);
1215struct DotStruct {}
1216#[ derive(Clone)] pub (crate) struct Dot(std::sync::Arc<DotStruct>);
1217impl Dot {
1218pub fn new() -> Dot {
1219    let selfish = Dot(std::sync::Arc::new(DotStruct {}));
1220    return selfish;
1221}
1222}
1223impl SpecialTrait for Dot {
1224fn clone_boxed(& self) -> Special {
1225    Special::new(self.clone())
1226}
1227}
1228impl RegexNodeTrait for Dot {
1229fn clone_boxed(& self) -> RegexNode {
1230    RegexNode::new(self.clone())
1231}
1232}
1233temper_core::impl_any_value_trait!(Dot, [Special, RegexNode]);
1234struct EndStruct {}
1235#[ derive(Clone)] pub (crate) struct End(std::sync::Arc<EndStruct>);
1236impl End {
1237pub fn new() -> End {
1238    let selfish = End(std::sync::Arc::new(EndStruct {}));
1239    return selfish;
1240}
1241}
1242impl SpecialTrait for End {
1243fn clone_boxed(& self) -> Special {
1244    Special::new(self.clone())
1245}
1246}
1247impl RegexNodeTrait for End {
1248fn clone_boxed(& self) -> RegexNode {
1249    RegexNode::new(self.clone())
1250}
1251}
1252temper_core::impl_any_value_trait!(End, [Special, RegexNode]);
1253struct WordBoundaryStruct {}
1254#[ derive(Clone)] pub (crate) struct WordBoundary(std::sync::Arc<WordBoundaryStruct>);
1255impl WordBoundary {
1256pub fn new() -> WordBoundary {
1257    let selfish = WordBoundary(std::sync::Arc::new(WordBoundaryStruct {}));
1258    return selfish;
1259}
1260}
1261impl SpecialTrait for WordBoundary {
1262fn clone_boxed(& self) -> Special {
1263    Special::new(self.clone())
1264}
1265}
1266impl RegexNodeTrait for WordBoundary {
1267fn clone_boxed(& self) -> RegexNode {
1268    RegexNode::new(self.clone())
1269}
1270}
1271temper_core::impl_any_value_trait!(WordBoundary, [Special, RegexNode]);
1272struct DigitStruct {}
1273#[ derive(Clone)] pub (crate) struct Digit(std::sync::Arc<DigitStruct>);
1274impl Digit {
1275pub fn new() -> Digit {
1276    let selfish = Digit(std::sync::Arc::new(DigitStruct {}));
1277    return selfish;
1278}
1279}
1280impl SpecialSetTrait for Digit {
1281fn clone_boxed(& self) -> SpecialSet {
1282    SpecialSet::new(self.clone())
1283}
1284}
1285impl CodePartTrait for Digit {
1286fn clone_boxed(& self) -> CodePart {
1287    CodePart::new(self.clone())
1288}
1289}
1290impl RegexNodeTrait for Digit {
1291fn clone_boxed(& self) -> RegexNode {
1292    RegexNode::new(self.clone())
1293}
1294}
1295impl SpecialTrait for Digit {
1296fn clone_boxed(& self) -> Special {
1297    Special::new(self.clone())
1298}
1299}
1300temper_core::impl_any_value_trait!(Digit, [SpecialSet, CodePart, RegexNode, Special]);
1301struct SpaceStruct {}
1302#[ derive(Clone)] pub (crate) struct Space(std::sync::Arc<SpaceStruct>);
1303impl Space {
1304pub fn new() -> Space {
1305    let selfish = Space(std::sync::Arc::new(SpaceStruct {}));
1306    return selfish;
1307}
1308}
1309impl SpecialSetTrait for Space {
1310fn clone_boxed(& self) -> SpecialSet {
1311    SpecialSet::new(self.clone())
1312}
1313}
1314impl CodePartTrait for Space {
1315fn clone_boxed(& self) -> CodePart {
1316    CodePart::new(self.clone())
1317}
1318}
1319impl RegexNodeTrait for Space {
1320fn clone_boxed(& self) -> RegexNode {
1321    RegexNode::new(self.clone())
1322}
1323}
1324impl SpecialTrait for Space {
1325fn clone_boxed(& self) -> Special {
1326    Special::new(self.clone())
1327}
1328}
1329temper_core::impl_any_value_trait!(Space, [SpecialSet, CodePart, RegexNode, Special]);
1330struct WordStruct {}
1331#[ derive(Clone)] pub (crate) struct Word(std::sync::Arc<WordStruct>);
1332impl Word {
1333pub fn new() -> Word {
1334    let selfish = Word(std::sync::Arc::new(WordStruct {}));
1335    return selfish;
1336}
1337}
1338impl SpecialSetTrait for Word {
1339fn clone_boxed(& self) -> SpecialSet {
1340    SpecialSet::new(self.clone())
1341}
1342}
1343impl CodePartTrait for Word {
1344fn clone_boxed(& self) -> CodePart {
1345    CodePart::new(self.clone())
1346}
1347}
1348impl RegexNodeTrait for Word {
1349fn clone_boxed(& self) -> RegexNode {
1350    RegexNode::new(self.clone())
1351}
1352}
1353impl SpecialTrait for Word {
1354fn clone_boxed(& self) -> Special {
1355    Special::new(self.clone())
1356}
1357}
1358temper_core::impl_any_value_trait!(Word, [SpecialSet, CodePart, RegexNode, Special]);
1359fn buildEscapeNeeds__161() -> temper_core::List<i32> {
1360let mut t___907: bool;
1361let mut t___908: bool;
1362let mut t___909: bool;
1363let mut t___910: bool;
1364let mut t___911: bool;
1365let mut t___912: bool;
1366let mut t___913: bool;
1367let mut t___914: bool;
1368let mut t___915: bool;
1369let mut t___916: bool;
1370let mut t___917: bool;
1371let mut t___918: bool;
1372let mut t___919: bool;
1373let mut t___920: bool;
1374let mut t___921: bool;
1375let mut t___922: bool;
1376let mut t___923: bool;
1377let mut t___924: bool;
1378let mut t___925: bool;
1379let mut t___926: bool;
1380let mut t___927: bool;
1381let mut t___928: bool;
1382let mut t___929: bool;
1383let mut t___930: bool;
1384let mut t___931: i32;
1385let escapeNeeds__372: temper_core::ListBuilder<i32> = temper_core::listed::new_builder();
1386let mut code__373: i32 = 0;
1387'loop___2677: while Some(code__373) < Some(127) {
1388    if Some(code__373) == Some(Codes::dash()) {
1389        t___914 = true;
1390    } else {
1391        if Some(code__373) == Some(Codes::space()) {
1392            t___913 = true;
1393        } else {
1394            if Some(code__373) == Some(Codes::underscore()) {
1395                t___912 = true;
1396            } else {
1397                if Some(Codes::digit0()) <= Some(code__373) {
1398                    t___907 = Some(code__373) <= Some(Codes::digit9());
1399                } else {
1400                    t___907 = false;
1401                }
1402                if t___907 {
1403                    t___911 = true;
1404                } else {
1405                    if Some(Codes::upper_a()) <= Some(code__373) {
1406                        t___908 = Some(code__373) <= Some(Codes::upper_z());
1407                    } else {
1408                        t___908 = false;
1409                    }
1410                    if t___908 {
1411                        t___910 = true;
1412                    } else {
1413                        if Some(Codes::lower_a()) <= Some(code__373) {
1414                            t___909 = Some(code__373) <= Some(Codes::lower_z());
1415                        } else {
1416                            t___909 = false;
1417                        }
1418                        t___910 = t___909;
1419                    }
1420                    t___911 = t___910;
1421                }
1422                t___912 = t___911;
1423            }
1424            t___913 = t___912;
1425        }
1426        t___914 = t___913;
1427    }
1428    if t___914 {
1429        t___931 = 0;
1430    } else {
1431        if Some(code__373) == Some(Codes::ampersand()) {
1432            t___930 = true;
1433        } else {
1434            if Some(code__373) == Some(Codes::backslash()) {
1435                t___929 = true;
1436            } else {
1437                if Some(code__373) == Some(Codes::caret()) {
1438                    t___928 = true;
1439                } else {
1440                    if Some(code__373) == Some(Codes::curly_left()) {
1441                        t___927 = true;
1442                    } else {
1443                        if Some(code__373) == Some(Codes::curly_right()) {
1444                            t___926 = true;
1445                        } else {
1446                            if Some(code__373) == Some(Codes::dot()) {
1447                                t___925 = true;
1448                            } else {
1449                                if Some(code__373) == Some(Codes::peso()) {
1450                                    t___924 = true;
1451                                } else {
1452                                    if Some(code__373) == Some(Codes::pipe()) {
1453                                        t___923 = true;
1454                                    } else {
1455                                        if Some(code__373) == Some(Codes::plus()) {
1456                                            t___922 = true;
1457                                        } else {
1458                                            if Some(code__373) == Some(Codes::question()) {
1459                                                t___921 = true;
1460                                            } else {
1461                                                if Some(code__373) == Some(Codes::round_left()) {
1462                                                    t___920 = true;
1463                                                } else {
1464                                                    if Some(code__373) == Some(Codes::round_right()) {
1465                                                        t___919 = true;
1466                                                    } else {
1467                                                        if Some(code__373) == Some(Codes::slash()) {
1468                                                            t___918 = true;
1469                                                        } else {
1470                                                            if Some(code__373) == Some(Codes::square_left()) {
1471                                                                t___917 = true;
1472                                                            } else {
1473                                                                if Some(code__373) == Some(Codes::square_right()) {
1474                                                                    t___916 = true;
1475                                                                } else {
1476                                                                    if Some(code__373) == Some(Codes::star()) {
1477                                                                        t___915 = true;
1478                                                                    } else {
1479                                                                        t___915 = Some(code__373) == Some(Codes::tilde());
1480                                                                    }
1481                                                                    t___916 = t___915;
1482                                                                }
1483                                                                t___917 = t___916;
1484                                                            }
1485                                                            t___918 = t___917;
1486                                                        }
1487                                                        t___919 = t___918;
1488                                                    }
1489                                                    t___920 = t___919;
1490                                                }
1491                                                t___921 = t___920;
1492                                            }
1493                                            t___922 = t___921;
1494                                        }
1495                                        t___923 = t___922;
1496                                    }
1497                                    t___924 = t___923;
1498                                }
1499                                t___925 = t___924;
1500                            }
1501                            t___926 = t___925;
1502                        }
1503                        t___927 = t___926;
1504                    }
1505                    t___928 = t___927;
1506                }
1507                t___929 = t___928;
1508            }
1509            t___930 = t___929;
1510        }
1511        if t___930 {
1512            t___931 = 2;
1513        } else {
1514            t___931 = 1;
1515        }
1516    }
1517    temper_core::listed::add( & escapeNeeds__372, t___931, None);
1518    code__373 = code__373.wrapping_add(1);
1519}
1520return temper_core::ListedTrait::to_list( & escapeNeeds__372);
1521}
1522pub fn entire(item__219: RegexNode) -> RegexNode {
1523return RegexNode::new(Sequence::new([temper_core::cast::<RegexNode>(begin().clone()).unwrap(), item__219.clone(), temper_core::cast::<RegexNode>(end().clone()).unwrap()]));
1524}
1525pub fn one_or_more(item__221: RegexNode, reluctant__549: Option<bool>) -> Repeat {
1526let reluctant__222: bool;
1527if reluctant__549.is_none() {
1528    reluctant__222 = false;
1529} else {
1530    reluctant__222 = reluctant__549.unwrap();
1531}
1532return Repeat::new(item__221.clone(), 1, None, Some(reluctant__222));
1533}
1534pub fn optional(item__224: RegexNode, reluctant__551: Option<bool>) -> Repeat {
1535let reluctant__225: bool;
1536if reluctant__551.is_none() {
1537    reluctant__225 = false;
1538} else {
1539    reluctant__225 = reluctant__551.unwrap();
1540}
1541return Repeat::new(item__224.clone(), 0, Some(1), Some(reluctant__225));
1542}