MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / rust_macro_arg_refs

Function rust_macro_arg_refs

codegraph-kernel/src/rustlang.rs:1958–1969  ·  view source on GitHub ↗

rustMacroArgRefs: none unless `mac` is one of RUST_EXPRESSION_MACROS.

(mac: Node<'t>, src: &'t str)

Source from the content-addressed store, hash-verified

1956
1957/// rustMacroArgRefs: none unless `mac` is one of RUST_EXPRESSION_MACROS.
1958fn rust_macro_arg_refs<'t>(mac: Node<'t>, src: &'t str) -> Vec<MacroRef<'t>> {
1959 let mut out = Vec::new();
1960 let name_node = mac.named_child(0);
1961 let tree = (0..mac.named_child_count()).filter_map(|i| mac.named_child(i)).find(|c| c.kind() == "token_tree");
1962 let (Some(name_node), Some(tree)) = (name_node, tree) else { return out };
1963 let full = macro_tok_text(name_node, src);
1964 let name = full.rsplit("::").next().unwrap_or(full).trim();
1965 if RUST_EXPRESSION_MACROS.contains(&name) {
1966 macro_scan_group(tree, name == "matches", false, src, &mut out);
1967 }
1968 out
1969}
1970
1971/// groupTokens: a group's tokens, its delimiters left out.
1972fn macro_group_tokens<'t>(group: Node<'t>) -> Vec<Node<'t>> {

Callers 1

Calls 3

macro_tok_textFunction · 0.85
macro_scan_groupFunction · 0.85
nextMethod · 0.80

Tested by

no test coverage detected