Function python_ast::parser::parse

source ·
pub fn parse<S1: Into<String>, S2: Into<String>>(
    input: S1,
    filename: S2
) -> PyResult<Module>
Expand description

Takes a string of bytes and returns the Python-tokenized version of it. use python_ast::parse;

fn read_python_file(input: std::path::Path) {
   let py = read_to_string(input).unwrap();
   let ast = parse(&py, "__main__").unwrap();

   println!("{:?}", ast);
}