MCPcopy Create free account
hub / github.com/davidblewett/rure-python / fill_split

Method fill_split

regex/src/compile.rs:657–697  ·  view source on GitHub ↗
(
        &mut self,
        hole: Hole,
        goto1: Option<InstPtr>,
        goto2: Option<InstPtr>,
    )

Source from the content-addressed store, hash-verified

655 }
656
657 fn fill_split(
658 &mut self,
659 hole: Hole,
660 goto1: Option<InstPtr>,
661 goto2: Option<InstPtr>,
662 ) -> Hole {
663 match hole {
664 Hole::None => Hole::None,
665 Hole::One(pc) => {
666 match (goto1, goto2) {
667 (Some(goto1), Some(goto2)) => {
668 self.insts[pc].fill_split(goto1, goto2);
669 Hole::None
670 }
671 (Some(goto1), None) => {
672 self.insts[pc].half_fill_split_goto1(goto1);
673 Hole::One(pc)
674 }
675 (None, Some(goto2)) => {
676 self.insts[pc].half_fill_split_goto2(goto2);
677 Hole::One(pc)
678 }
679 (None, None) => unreachable!("at least one of the split \
680 holes must be filled"),
681 }
682 }
683 Hole::Many(holes) => {
684 let mut new_holes = vec![];
685 for hole in holes {
686 new_holes.push(self.fill_split(hole, goto1, goto2));
687 }
688 if new_holes.is_empty() {
689 Hole::None
690 } else if new_holes.len() == 1 {
691 new_holes.pop().unwrap()
692 } else {
693 Hole::Many(new_holes)
694 }
695 }
696 }
697 }
698
699 fn push_compiled(&mut self, inst: Inst) {
700 self.insts.push(MaybeInst::Compiled(inst));

Callers 8

compile_manyMethod · 0.80
c_class_bytesMethod · 0.80
c_alternateMethod · 0.80
c_repeat_zero_or_oneMethod · 0.80
c_repeat_zero_or_moreMethod · 0.80
c_repeat_one_or_moreMethod · 0.80
c_repeat_rangeMethod · 0.80
compileMethod · 0.80

Calls 8

half_fill_split_goto1Method · 0.80
half_fill_split_goto2Method · 0.80
unwrapMethod · 0.80
SplitClass · 0.70
pushMethod · 0.45
is_emptyMethod · 0.45
lenMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected