2 unstable releases
0.2.0 | Aug 15, 2024 |
---|---|
0.1.0 | Aug 15, 2024 |
#1564 in Procedural macros
2,880 downloads per month
Used in neocmakelsp
7KB
120 lines
treesitter-type-collector
Macro example to generate all kind names in node-types.json, and make them to a mod.
Example:
use treesitter_type_collector::tree_sitter_consts;
#[tree_sitter_consts("asserts/node-types.json")]
struct NodeTypes;
fn main() {
println!("{}", NodeTypes::KIND_ARGUMENT);
println!("{:?}", NodeTypes::NODE_TYPES);
}
lib.rs
:
Auto transport node_types.json to rust mod
Min example
use treesitter_kind_collector::tree_sitter_kinds;
#[tree_sitter_kinds("asserts/node-types.json")]
struct NodeKindTypes;
fn main() {
println!("{}", NodeKindTypes::ARGUMENT);
println!("{:?}", NodeKindTypes::NODE_TYPES);
}
Dependencies
~0.7–1.6MB
~35K SLoC