Team Ai
Apppublic

aravagarwal/CodeCloakPII

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
README.md36 linesDownload Raw Back to rust
1# tree-sitter-python2 3This crate provides a Python grammar for the [tree-sitter][] parsing library.4To use this crate, add it to the `[dependencies]` section of your `Cargo.toml`5file. (Note that you will probably also need to depend on the6[`tree-sitter`][tree-sitter crate] crate to use the parsed result in any useful7way.)8 9```toml10[dependencies]11tree-sitter = "0.20.10"12tree-sitter-python = "0.20.4"13```14 15Typically, you will use the [language][language func] function to add this16grammar to a tree-sitter [Parser][], and then use the parser to parse some code:17 18```rust19let code = r#"20    def double(x):21        return x * 222"#;23let mut parser = Parser::new();24parser.set_language(tree_sitter_python::language()).expect("Error loading Python grammar");25let parsed = parser.parse(code, None);26```27 28If you have any questions, please reach out to us in the [tree-sitter29discussions] page.30 31[language func]: https://docs.rs/tree-sitter-python/*/tree_sitter_python/fn.language.html32[Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html33[tree-sitter]: https://tree-sitter.github.io/34[tree-sitter crate]: https://crates.io/crates/tree-sitter35[tree-sitter discussions]: https://github.com/tree-sitter/tree-sitter/discussions36