Yeast: Skip unnamed tokens in AST dump output

Unnamed tokens (keywords, operators, punctuation) in the unnamed
children bucket are no longer shown in dump output. They still appear
if they are inside a named field.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Taus
2026-05-01 13:53:59 +00:00
parent 2113ba7f61
commit bc48ea4e3c

View File

@@ -100,10 +100,14 @@ fn dump_node(ast: &Ast, id: usize, source: &str, options: &DumpOptions, indent:
}
}
// Unnamed children
// Unnamed children — skip unnamed tokens (keywords, punctuation)
if let Some(children) = node.fields.get(&CHILD_FIELD) {
for &child_id in children {
dump_node(ast, child_id, source, options, indent + 1, out);
if let Some(child) = ast.get_node(child_id) {
if child.is_named() {
dump_node(ast, child_id, source, options, indent + 1, out);
}
}
}
}
}