pub fn mamba_to_python(
    _source: &[(String, Option<PathBuf>)]
) -> Result<Vec<String>, Vec<(String, String)>> {
    let tokens = tokenize_all(_source).map_err(|errs| {
        errs.iter()
            .map(|err| (String::from("token"), format!("{}", err)))
            .collect::<Vec<(String, String)>>()
    })?;
    trace!("Tokenized {} files", tokens.len());

    let asts = parse_all(tokens.as_slice()).map_err(|errs| {
        errs.iter()
            .map(|err| (String::from("syntax"), format!("{}", err)))
            .collect::<Vec<(String, String)>>()
    })?;
    trace!("Parsed {} files", asts.len());

    let modified_trees = check_all(asts.as_slice()).map_err(|errs| {
        errs.iter()
            .map(|err| (String::from("type"), format!("{}", err)))
            .collect::<Vec<(String, String)>>()
    })?;
    trace!("Checked {} files", modified_trees.len());

    let core_tree = desugar_all(modified_trees.as_slice()).map_err(|errs| {
        errs.iter()
            .map(|err| (String::from("unimplemented"), format!("{}", err)))
            .collect::<Vec<(String, String)>>()
    })?;
    trace!("Converted {} checked files to Python", core_tree.len());

    Ok(core_tree.iter().map(|(core, ..)| to_source(core)).collect())
}
/// Convert mamba source to python source.
///
/// For each mamba source, a path can optionally be given for display in error
/// messages. This path is not necessary however.
Convert mamba source to python source.
For each mamba source, a path can optionally be given for display in error
messages. This path is not necessary however.
Convert mamba source to python source . For each mamba source a path can optionally be given for display in error messages . This path is not necessary however .
pub fn mamba_to_python(
    _source: &[(String, Option<PathBuf>)]
) -> Result<Vec<String>, Vec<(String, String)>> {
    let tokens = tokenize_all(_source).map_err(|errs| {
        errs.iter()
            .map(|err| (String::from("token"), format!("{}", err)))
            .collect::<Vec<(String, String)>>()
    })?;
    trace!("Tokenized {} files", tokens.len());
    let asts = parse_all(tokens.as_slice()).map_err(|errs| {
        errs.iter()
            .map(|err| (String::from("syntax"), format!("{}", err)))
            .collect::<Vec<(String, String)>>()
    })?;
    trace!("Parsed {} files", asts.len());
    let modified_trees = check_all(asts.as_slice()).map_err(|errs| {
        errs.iter()
            .map(|err| (String::from("type"), format!("{}", err)))
            .collect::<Vec<(String, String)>>()
    })?;
    trace!("Checked {} files", modified_trees.len());
    let core_tree = desugar_all(modified_trees.as_slice()).map_err(|errs| {
        errs.iter()
            .map(|err| (String::from("unimplemented"), format!("{}", err)))
            .collect::<Vec<(String, String)>>()
    })?;
    trace!("Converted {} checked files to Python", core_tree.len());
    Ok(core_tree.iter().map(|(core, ..)| to_source(core)).collect())
}
pub fn mamba_to_python ( _source : & [ ( String , Option < PathBuf > ) ] ) -> Result < Vec < String > , Vec < ( String , String ) > > { let tokens = tokenize_all ( _source ) . map_err ( | errs | { errs . iter ( ) . map ( | err | ( String :: from ( " " ) , format ! ( " " err ) ) ) . collect :: < Vec < ( String , String ) > > ( ) } ) ? ; trace ! ( " " tokens len ( ) ) ; let asts = parse_all ( tokens . as_slice ( ) ) . map_err ( | errs | { errs . iter ( ) . map ( | err | ( String :: from ( " " ) , format ! ( " " err ) ) ) . collect :: < Vec < ( String , String ) > > ( ) } ) ? ; trace ! ( " " asts len ( ) ) ; let modified_trees = check_all ( asts . as_slice ( ) ) . map_err ( | errs | { errs . iter ( ) . map ( | err | ( String :: from ( " " ) , format ! ( " " err ) ) ) . collect :: < Vec < ( String , String ) > > ( ) } ) ? ; trace ! ( " " modified_trees len ( ) ) ; let core_tree = desugar_all ( modified_trees . as_slice ( ) ) . map_err ( | errs | { errs . iter ( ) . map ( | err | ( String :: from ( " " ) , format ! ( " " err ) ) ) . collect :: < Vec < ( String , String ) > > ( ) } ) ? ; trace ! ( " " core_tree len ( ) ) ; Ok ( core_tree . iter ( ) . map ( | ( core , .. ) | to_source ( core ) ) . collect ( ) ) }
Convert mamba source to python source.
Convert mamba source to python source .
_source
&[(String, Option<PathBuf>)]