pub fn parse_file(
    fm: &mut FileManager,
    file_id: FileId,
) -> Result<ParsedModule, Vec<CollectedErrors>> {
    let file = fm.fetch_file(file_id);
    let mut parser = Parser::from_src(file.get_source());
    match parser.parse_program() {
        Ok(prog) => Ok(prog),
        Err(errs) => {
            let file_errs = CollectedErrors {
                file_id,
                errors: errs.iter().map(|err| err.to_diagnostic()).collect(),
            };

            Err(vec![file_errs])
        }
    }
}
/// Given a FileId, fetch the File, from the FileManager and parse it's content
Given a FileId, fetch the File, from the FileManager and parse it's content
Given a FileId fetch the File from the FileManager and parse it ' s content
pub fn parse_file(
    fm: &mut FileManager,
    file_id: FileId,
) -> Result<ParsedModule, Vec<CollectedErrors>> {
    let file = fm.fetch_file(file_id);
    let mut parser = Parser::from_src(file.get_source());
    match parser.parse_program() {
        Ok(prog) => Ok(prog),
        Err(errs) => {
            let file_errs = CollectedErrors {
                file_id,
                errors: errs.iter().map(|err| err.to_diagnostic()).collect(),
            };
            Err(vec![file_errs])
        }
    }
}
pub fn parse_file ( fm : & mut FileManager , file_id : FileId , ) -> Result < ParsedModule , Vec < CollectedErrors > > { let file = fm . fetch_file ( file_id ) ; let mut parser = Parser :: from_src ( file . get_source ( ) ) ; match parser . parse_program ( ) { Ok ( prog ) => Ok ( prog ) , Err ( errs ) => { let file_errs = CollectedErrors { file_id , errors : errs . iter ( ) . map ( | err | err . to_diagnostic ( ) ) . collect ( ) , } ; Err ( vec ! [ file_errs ] ) } } }
Given a FileId, fetch the File, from the FileManager and parse it's content
Given a FileId fetch the File from the FileManager and parse it ' s content
fm
&mut FileManager
file_id
FileId
fm
&mut FileManager
file_id
FileId