pub fn parse(&self, src: &str) -> Result<Program, Vec<Simple<String>>> {
        let (tokens, errs) = self.lexer.parse_recovery(src);
        let mut errs: Vec<_> = errs.into_iter().map(|e| e.map(|c| c.to_string())).collect();

        if let Some(tokens) = tokens {
            // println!("Tokens = {:?}", tokens);
            let len = src.chars().count();
            let stream = Stream::from_iter(len..len + 1, tokens.into_iter());
            let (prog, parse_errs) = self.parser.parse_recovery(stream);
            match prog {
                Some(prog) if errs.is_empty() && parse_errs.is_empty() => Ok(prog),
                _ => {
                    errs.extend(parse_errs.into_iter().map(|e| e.map(|c| c.to_string())));
                    Err(errs)
                }
            }
        } else {
            Err(errs)
        }
    }
/// Parse an input source file, returning the program or a list of errors.
Parse an input source file, returning the program or a list of errors.
Parse an input source file returning the program or a list of errors .
pub fn parse(&self, src: &str) -> Result<Program, Vec<Simple<String>>> {
        let (tokens, errs) = self.lexer.parse_recovery(src);
        let mut errs: Vec<_> = errs.into_iter().map(|e| e.map(|c| c.to_string())).collect();
        if let Some(tokens) = tokens {
            // println!("Tokens = {:?}", tokens);
            let len = src.chars().count();
            let stream = Stream::from_iter(len..len + 1, tokens.into_iter());
            let (prog, parse_errs) = self.parser.parse_recovery(stream);
            match prog {
                Some(prog) if errs.is_empty() && parse_errs.is_empty() => Ok(prog),
                _ => {
                    errs.extend(parse_errs.into_iter().map(|e| e.map(|c| c.to_string())));
                    Err(errs)
                }
            }
        } else {
            Err(errs)
        }
    }
pub fn parse ( & self , src : & str ) -> Result < Program , Vec < Simple < String > > > { let ( tokens , errs ) = self . lexer . parse_recovery ( src ) ; let mut errs : Vec < _ > = errs . into_iter ( ) . map ( | e | e . map ( | c | c . to_string ( ) ) ) . collect ( ) ; if let Some ( tokens ) = tokens { // println!("Tokens = {:?}", tokens); let len = src . chars ( ) . count ( ) ; let stream = Stream :: from_iter ( len .. len + 1 , tokens . into_iter ( ) ) ; let ( prog , parse_errs ) = self . parser . parse_recovery ( stream ) ; match prog { Some ( prog ) if errs . is_empty ( ) && parse_errs . is_empty ( ) => Ok ( prog ) , _ => { errs . extend ( parse_errs . into_iter ( ) . map ( | e | e . map ( | c | c . to_string ( ) ) ) ) ; Err ( errs ) } } } else { Err ( errs ) } }
Parse an input source file, returning the program or a list of errors.
Parse an input source file returning the program or a list of errors .
&self
src
&str
&self
src
&str