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

Function rust_macro_arg_refs

codegraph-kernel/src/rustlang.rs:1989–2000  ·  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

1987
1988/// rustMacroArgRefs: none unless `mac` is one of RUST_EXPRESSION_MACROS.
1989fn rust_macro_arg_refs<'t>(mac: Node<'t>, src: &'t str) -> Vec<MacroRef<'t>> {
1990 let mut out = Vec::new();
1991 let name_node = mac.named_child(0);
1992 let tree = (0..mac.named_child_count()).filter_map(|i| mac.named_child(i)).find(|c| c.kind() == "token_tree");
1993 let (Some(name_node), Some(tree)) = (name_node, tree) else { return out };
1994 let full = macro_tok_text(name_node, src);
1995 let name = full.rsplit("::").next().unwrap_or(full).trim();
1996 if RUST_EXPRESSION_MACROS.contains(&name) {
1997 macro_scan_group(tree, name == "matches", false, src, &mut out);
1998 }
1999 out
2000}
2001
2002/// groupTokens: a group's tokens, its delimiters left out.
2003fn 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