pub fn generate(
source: &str,
language: &Language,
tokens: Option<HashMap<&'static str, &'static str>>,
) -> TokenStreamExpand description
Generates the Rust code for a given Tree-sitter grammar
§Arguments
source- node-types.jsonlanguage- tree-sitter language fntokens- optional map of tokens to enum names (since tokens can’t be valid rust identifiers)
§Returns
A TokenStream containing the generated code
§Example
use auto_lsp_codegen::generate;
let _result = generate(
&tree_sitter_python::NODE_TYPES,
&tree_sitter_python::LANGUAGE.into(),
None,
);