use pydocstring::parse::numpy::{NumPyDocstring, parse_numpy};
fn main() {
let docstring = r#"
Calculate the area of a rectangle.
This function takes the width and height of a rectangle
and returns its area.
Parameters
----------
width : float
The width of the rectangle.
height : float
The height of the rectangle.
Returns
-------
float
The area of the rectangle.
Raises
------
ValueError
If width or height is negative.
Examples
--------
>>> calculate_area(5.0, 3.0)
15.0
"#;
let parsed = parse_numpy(docstring);
let doc = NumPyDocstring::cast(parsed.root()).unwrap();
println!("╔══════════════════════════════════════════════════╗");
println!("║ NumPy-style Docstring Example ║");
println!("╚══════════════════════════════════════════════════╝");
println!();
println!("── raw text ────────────────────────────────────────");
println!("{}", doc.syntax().range().source_text(parsed.source()));
println!();
println!("── parsed AST ──────────────────────────────────────");
print!("{}", parsed.pretty_print());
}