#tree-sitter #parser #incremental #python-docstring

tree-sitter-python-docstring

PythonDocstring grammar for tree-sitter

1 unstable release

0.0.1 Aug 21, 2024

#154 in #parsing

Download history 119/week @ 2024-08-17 13/week @ 2024-08-24

132 downloads per month

MIT license

155KB
4.5K SLoC

C 4.5K SLoC JavaScript 88 SLoC // 0.0% comments Rust 29 SLoC // 0.3% comments

tree-sitter-pydocstring

Python docstring (google style) grammar for tree-sitter.


lib.rs:

This crate provides PythonDocstring language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_python_docstring::language()).expect("Error loading PythonDocstring grammar");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~2.8–4MB
~73K SLoC