use crate::{
query::adj_ast,
syntax::{
builders::execution_block::build_execution_block_node, SyntaxGraphArgs, SyntaxGraphError,
},
CodeGraph, NodeId,
};
use alloc::vec::Vec;
pub fn reader(
args: &mut SyntaxGraphArgs<'_>,
n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
let graph = args.ast_graph;
let labels_to_ignore = &["else", "do", "end", ";", "{", "}"];
let c_ids: Vec<NodeId> = adj_ast(graph, n_id, Some(1), &[])
.into_iter()
.filter(|&c_ids| !labels_to_ignore.contains(&graph.label_type(c_ids).unwrap_or("")))
.collect();
build_execution_block_node(args, n_id, &c_ids).map(Some)
}