Crate type_sitter_gen

Crate type_sitter_gen 

Source
Expand description

§type-sitter-gen: base functionality to generate typed wrapper nodes for type-sitter

crates.io docs.rs

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§

AnonUnionId
Id for an anonymous union to reference it and prevent duplicates
Children
Describes a node’s named children: their types and quantity.
GeneratedNodeTokens
Generated AST tokens from calling [NodeType::print] on a single instance or each element of a collection.
GeneratedQueryTokens
Generated AST tokens from calling [SExpSeq::print] on a single instance or each element of a collection.
NodeName
Uniquely identifies a node within a grammar.
NodeType
Describes a grammar node; corresponds to an entry in node-types.json
NodeTypeMap
Represents the contents of the node-types.json in a form that can be converted to Rust code.

Enums§

Error
NodeModule
Where a node type is located.
NodeTypeKind

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::raw and type_sitter respectively.
generate_queries
Generate source code (tokens) of wrappers for queries, and the generated code will refer to the provided modules instead of type_sitter::raw and type_sitter respectively.
generate_queries_with_custom_module_paths
Generate source code (tokens) of wrappers for queries.
generate_query_from_file
Same as generate_queries, but path must 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, but path must 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 the tree_sitter crate.
type_sitter
= parse_quote!(::type_sitter). The default path to the type_sitter crate.
type_sitter_lib
= parse_quote!(::type_sitter_lib). The default path to the type_sitter_lib crate.
type_sitter_raw
= parse_quote!(::type_sitter::raw). The default path to re-exported tree-sitter or yak-sitter from type-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§

AnonUnions
Holds the tokens to define anonymous unions, so that there aren’t duplicates