Docs.rs
  • tree-sitter-python-0.23.6
    • tree-sitter-python 0.23.6
    • Docs.rs crate page
    • MIT
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • maxbrunsfeld
    • dcreager
    • Dependencies
      • tree-sitter-language ^0.1 normal
      • tree-sitter ^0.24 dev
      • cc ^1.1 build
    • Versions
    • 100% of the crate is documented
  • Platform
    • i686-unknown-linux-gnu
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate tree_sitter_python

tree_sitter_python0.23.6

  • All Items

Crate Items

  • Constants

Crates

  • tree_sitter_python

Crate tree_sitter_python

Source
Expand description

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

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

use tree_sitter::Parser;

let code = r#"
    def double(x):
        return x * 2
"#;
let mut parser = Parser::new();
let language = tree_sitter_python::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading Python parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Constants§

HIGHLIGHTS_QUERY
The syntax highlighting query for this language.
LANGUAGE
The tree-sitter LanguageFn for this grammar.
NODE_TYPES
The content of the node-types.json file for this grammar.
TAGS_QUERY
The symbol tagging query for this language.

Results

Settings
Help

Query parser error: "Unexpected - (did you mean ->?)".