1#![warn(missing_docs, clippy::all, clippy::pedantic)]
14#![deny(unsafe_code)]
15#![allow(
16 clippy::doc_markdown,
17 clippy::single_match_else,
18 clippy::single_match,
19 clippy::module_name_repetitions,
20 clippy::str_to_string,
21 clippy::unwrap_used,
22 clippy::panic
23)]
24
25pub mod hir_converter;
26pub mod parser;
27pub mod type_extractor;
28
29use anyhow::Result;
30use spydecy_hir::python::PythonHIR;
31
32pub fn parse_python(source: &str, filename: &str) -> Result<PythonHIR> {
38 let ast = parser::parse(source, filename)?;
39 hir_converter::convert_to_hir(&ast)
40}
41
42#[cfg(test)]
43mod tests {
44 use super::*;
45
46 #[test]
47 fn test_parse_simple_function() {
48 let source = r"
49def my_len(x):
50 return len(x)
51";
52 let result = parse_python(source, "test.py");
53 assert!(result.is_ok());
54 }
55}