use alloc::vec::Vec;
use crate::query::adj_ast;
use crate::syntax::builders::execution_block::build_execution_block_node;
use crate::syntax::{SyntaxGraphArgs, SyntaxGraphError};
use crate::{CodeGraph, NodeId};
pub fn reader(
args: &mut SyntaxGraphArgs<'_>,
n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
let graph = args.ast_graph;
let all = adj_ast(graph, n_id, None, &[]);
let inner = all.get(1..all.len().saturating_sub(1)).unwrap_or(&[]);
let c_ids: Vec<NodeId> = inner
.iter()
.copied()
.filter(|c_id| graph.label_type(*c_id) != Some(";"))
.collect();
build_execution_block_node(args, n_id, &c_ids).map(Some)
}