pub fn build(self) -> Result<Exec, Error> {
        if self.res.is_empty() {
            let ro = Arc::new(ExecReadOnly {
                res: vec![],
                nfa: Program::new(),
                dfa: Program::new(),
                dfa_reverse: Program::new(),
                suffixes: LiteralSearcher::empty(),
                match_type: MatchType::Nothing,
            });
            let ro_ = ro.clone();
            return Ok(Exec { ro: ro, cache: create_pool(ro_) });
        }
        let parsed = try!(Parsed::parse(&self.res, self.only_utf8));
        let mut nfa = try!(
            Compiler::new()
                     .size_limit(self.size_limit)
                     .bytes(self.bytes)
                     .only_utf8(self.only_utf8)
                     .compile(&parsed.exprs));
        let mut dfa = try!(
            Compiler::new()
                     .size_limit(self.size_limit)
                     .dfa(true)
                     .only_utf8(self.only_utf8)
                     .compile(&parsed.exprs));
        let dfa_reverse = try!(
            Compiler::new()
                     .size_limit(self.size_limit)
                     .dfa(true)
                     .only_utf8(self.only_utf8)
                     .reverse(true)
                     .compile(&parsed.exprs));

        let prefixes = parsed.prefixes.unambiguous_prefixes();
        let suffixes = parsed.suffixes.unambiguous_suffixes();
        nfa.prefixes = LiteralSearcher::prefixes(prefixes);
        dfa.prefixes = nfa.prefixes.clone();

        let mut ro = ExecReadOnly {
            res: self.res,
            nfa: nfa,
            dfa: dfa,
            dfa_reverse: dfa_reverse,
            suffixes: LiteralSearcher::suffixes(suffixes),
            match_type: MatchType::Nothing,
        };
        ro.match_type = ro.choose_match_type(self.match_type);
        // println!("MATCH TYPE for '{:?}': {:?}", ro.res, ro.match_type);

        let ro = Arc::new(ro);
        let ro_ = ro.clone();
        Ok(Exec { ro: ro, cache: create_pool(ro_) })
    }
/// Build an executor that can run a regular expression.
Build an executor that can run a regular expression.
Build an executor that can run a regular expression .
pub fn build(self) -> Result<Exec, Error> {
        if self.res.is_empty() {
            let ro = Arc::new(ExecReadOnly {
                res: vec![],
                nfa: Program::new(),
                dfa: Program::new(),
                dfa_reverse: Program::new(),
                suffixes: LiteralSearcher::empty(),
                match_type: MatchType::Nothing,
            });
            let ro_ = ro.clone();
            return Ok(Exec { ro: ro, cache: create_pool(ro_) });
        }
        let parsed = try!(Parsed::parse(&self.res, self.only_utf8));
        let mut nfa = try!(
            Compiler::new()
                     .size_limit(self.size_limit)
                     .bytes(self.bytes)
                     .only_utf8(self.only_utf8)
                     .compile(&parsed.exprs));
        let mut dfa = try!(
            Compiler::new()
                     .size_limit(self.size_limit)
                     .dfa(true)
                     .only_utf8(self.only_utf8)
                     .compile(&parsed.exprs));
        let dfa_reverse = try!(
            Compiler::new()
                     .size_limit(self.size_limit)
                     .dfa(true)
                     .only_utf8(self.only_utf8)
                     .reverse(true)
                     .compile(&parsed.exprs));
        let prefixes = parsed.prefixes.unambiguous_prefixes();
        let suffixes = parsed.suffixes.unambiguous_suffixes();
        nfa.prefixes = LiteralSearcher::prefixes(prefixes);
        dfa.prefixes = nfa.prefixes.clone();
        let mut ro = ExecReadOnly {
            res: self.res,
            nfa: nfa,
            dfa: dfa,
            dfa_reverse: dfa_reverse,
            suffixes: LiteralSearcher::suffixes(suffixes),
            match_type: MatchType::Nothing,
        };
        ro.match_type = ro.choose_match_type(self.match_type);
        // println!("MATCH TYPE for '{:?}': {:?}", ro.res, ro.match_type);
        let ro = Arc::new(ro);
        let ro_ = ro.clone();
        Ok(Exec { ro: ro, cache: create_pool(ro_) })
    }
pub fn build ( self ) -> Result < Exec , Error > { if self . res . is_empty ( ) { let ro = Arc :: new ( ExecReadOnly { res : vec ! [ ] , nfa : Program :: new ( ) , dfa : Program :: new ( ) , dfa_reverse : Program :: new ( ) , suffixes : LiteralSearcher :: empty ( ) , match_type : MatchType :: Nothing , } ) ; let ro_ = ro . clone ( ) ; return Ok ( Exec { ro : ro , cache : create_pool ( ro_ ) } ) ; } let parsed = try ! ( Parsed parse ( self res self only_utf8 ) ) ; let mut nfa = try ! ( Compiler new ( ) size_limit ( self size_limit ) bytes ( self bytes ) only_utf8 ( self only_utf8 ) compile ( parsed exprs ) ) ; let mut dfa = try ! ( Compiler new ( ) size_limit ( self size_limit ) dfa ( true ) only_utf8 ( self only_utf8 ) compile ( parsed exprs ) ) ; let dfa_reverse = try ! ( Compiler new ( ) size_limit ( self size_limit ) dfa ( true ) only_utf8 ( self only_utf8 ) reverse ( true ) compile ( parsed exprs ) ) ; let prefixes = parsed . prefixes . unambiguous_prefixes ( ) ; let suffixes = parsed . suffixes . unambiguous_suffixes ( ) ; nfa . prefixes = LiteralSearcher :: prefixes ( prefixes ) ; dfa . prefixes = nfa . prefixes . clone ( ) ; let mut ro = ExecReadOnly { res : self . res , nfa : nfa , dfa : dfa , dfa_reverse : dfa_reverse , suffixes : LiteralSearcher :: suffixes ( suffixes ) , match_type : MatchType :: Nothing , } ; ro . match_type = ro . choose_match_type ( self . match_type ) ; // println!("MATCH TYPE for '{:?}': {:?}", ro.res, ro.match_type); let ro = Arc :: new ( ro ) ; let ro_ = ro . clone ( ) ; Ok ( Exec { ro : ro , cache : create_pool ( ro_ ) } ) }
Build an executor that can run a regular expression.
Build an executor that can run a regular expression .
self
self