generate_queries

Macro generate_queries 

Source
generate_queries!() { /* proc-macro */ }
Expand description

Generate typed wrappers for tree-sitter queries.

§Parameters

  • 0: Path to the queries, relative to the crate root. Must point to a .scm or directory of .scm files. If a directory, this function will generate submodules for each .scm.
  • 1: the path to the tree-sitter language root, relative to the crate root. Typically vendor/tree-sitter-<language>.
  • 2: Path to the crate with the typed node wrappers. Typically super::nodes (and then put an invocation of generate_nodes! at top-level in the sister crate nodes.rs).

§Example

use type_sitter_proc::generate_queries;

generate_queries!("vendor/tree-sitter-typescript/queries/tags.scm", "vendor/tree-sitter-typescript", super::typescript_nodes);
generate_queries!("vendor/tree-sitter-rust/queries", "vendor/tree-sitter-rust", super::rust_nodes);