pub fn gen_regex(&mut self, chunk: &Chunk, i: usize) -> bool {
        match self {
            Value::String(s, ref mut current_regex) => {
                let regex_res = Regex::new(s);
                match regex_res {
                    Ok(regex) => {
                        *current_regex = Some(regex.clone());
                        return true;
                    }
                    Err(e) => {
                        let mut err_str = format!("{}", e);
                        let regex_nl = Regex::new("\n").unwrap();
                        err_str = regex_nl.replace_all(&err_str, "").to_string();
                        let regex_errpart = Regex::new(".*error:\\s*").unwrap();
                        err_str = regex_errpart.replace(&err_str, "").to_string();
                        err_str = format!("invalid regex: {}", err_str);
                        print_error(chunk, i, &err_str);
                        return false;
                    }
                }
            }
            _ => {
                eprintln!("unable to make regex from non-string!");
                std::process::abort();
            }
        }
    }
/// For a string value, generate the corresponding regex for the
/// string value and store it in the value.  If called on a
/// non-string value, this will abort the current process.
For a string value, generate the corresponding regex for the
string value and store it in the value.  If called on a
non-string value, this will abort the current process.
For a string value generate the corresponding regex for the string value and store it in the value . If called on a non - string value this will abort the current process .
pub fn gen_regex(&mut self, chunk: &Chunk, i: usize) -> bool {
        match self {
            Value::String(s, ref mut current_regex) => {
                let regex_res = Regex::new(s);
                match regex_res {
                    Ok(regex) => {
                        *current_regex = Some(regex.clone());
                        return true;
                    }
                    Err(e) => {
                        let mut err_str = format!("{}", e);
                        let regex_nl = Regex::new("\n").unwrap();
                        err_str = regex_nl.replace_all(&err_str, "").to_string();
                        let regex_errpart = Regex::new(".*error:\\s*").unwrap();
                        err_str = regex_errpart.replace(&err_str, "").to_string();
                        err_str = format!("invalid regex: {}", err_str);
                        print_error(chunk, i, &err_str);
                        return false;
                    }
                }
            }
            _ => {
                eprintln!("unable to make regex from non-string!");
                std::process::abort();
            }
        }
    }
pub fn gen_regex ( & mut self , chunk : & Chunk , i : usize ) -> bool { match self { Value :: String ( s , ref mut current_regex ) => { let regex_res = Regex :: new ( s ) ; match regex_res { Ok ( regex ) => { * current_regex = Some ( regex . clone ( ) ) ; return true ; } Err ( e ) => { let mut err_str = format ! ( " " e ) ; let regex_nl = Regex :: new ( " \n " ) . unwrap ( ) ; err_str = regex_nl . replace_all ( & err_str , " " ) . to_string ( ) ; let regex_errpart = Regex :: new ( " \\ " ) . unwrap ( ) ; err_str = regex_errpart . replace ( & err_str , " " ) . to_string ( ) ; err_str = format ! ( " " err_str ) ; print_error ( chunk , i , & err_str ) ; return false ; } } } _ => { eprintln ! ( " " ) ; std :: process :: abort ( ) ; } } }
For a string value, generate the corresponding regex for the
string value and store it in the value.
For a string value generate the corresponding regex for the string value and store it in the value .
&mut self
chunk
&Chunk
i
usize