Expand description
§type-sitter-gen: base functionality to generate typed wrapper nodes for type-sitter
See type-sitter for background information. This library allows you to
generate type-sitter wrappers with more flexibility than type-sitter-cli
and type-sitter-proc. It’s the only way (outside of manually editing code
generated by type-sitter-cli) to generate wrappers which import something that isn’t tree_sitter, generate queries
without some of their patterns and captures, or combine multiple generations into one file.
Structs§
- Anon
Union Id - Id for an anonymous union to reference it and prevent duplicates
- Children
- Describes a node’s named children: their types and quantity.
- Generated
Node Tokens - Generated AST tokens from calling [
NodeType::print] on a single instance or each element of a collection. - Generated
Query Tokens - Generated AST tokens from calling [SExpSeq::print] on a single instance or each element of a collection.
- Node
Name - Uniquely identifies a node within a grammar.
- Node
Type - Describes a grammar node; corresponds to an entry in
node-types.json - Node
Type Map - Represents the contents of the
node-types.jsonin a form that can be converted to Rust code.
Enums§
- Error
- Node
Module - Where a node type is located.
- Node
Type Kind
Functions§
- dylib_
path - Returns the path of the dynamic library that type-sitter looks for when generating queries.
- generate_
nodes - Generate source code (tokens) for typed AST node wrappers.
- generate_
nodes_ with_ custom_ module_ paths - Generate source code (tokens) for typed AST node wrappers, and the generated code will refer to
the provided modules instead of
type_sitter::rawandtype_sitterrespectively. - generate_
queries - Generate source code (tokens) of wrappers for queries, and the generated code will refer to the
provided modules instead of
type_sitter::rawandtype_sitterrespectively. - generate_
queries_ with_ custom_ module_ paths - Generate source code (tokens) of wrappers for queries.
- generate_
query_ from_ file - Same as
generate_queries, butpathmust point to a file and you can specify patterns and captures to skip. - generate_
query_ from_ file_ with_ custom_ module_ paths - Same as
generate_queries_with_custom_module_paths, butpathmust point to a file and you can specify patterns and captures to skip. - super_
nodes - =
parse_quote!(super::nodes). The default path to the typed nodes crate from the queries crate. What you will often pass to generate_queries and co. - tree_
sitter - =
parse_quote!(::tree_sitter). The default path to thetree_sittercrate. - type_
sitter - =
parse_quote!(::type_sitter). The default path to thetype_sittercrate. - type_
sitter_ lib - =
parse_quote!(::type_sitter_lib). The default path to thetype_sitter_libcrate. - type_
sitter_ raw - =
parse_quote!(::type_sitter::raw). The default path to re-exportedtree-sitteroryak-sitterfromtype-sitter. - yak_
sitter - =
parse_quote!(::yak_sitter). Path to a wrapper which provides convenience functions for tree-sitter nodes at the cost of worse performance.
Type Aliases§
- Anon
Unions - Holds the tokens to define anonymous unions, so that there aren’t duplicates