fluidattacks-blends-domain 0.2.0

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
//! Counterpart of `blends/syntax/readers/c_sharp/expression_statement.py`.

use alloc::vec::Vec;

use crate::query::adj_ast;
use crate::syntax::builders::expression_statement::build_expression_statement_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 c_ids: Vec<NodeId> = adj_ast(graph, n_id, None, &[])
        .into_iter()
        .filter(|c_id| graph.label_type(*c_id) != Some(";"))
        .collect();
    build_expression_statement_node(args, n_id, &c_ids).map(Some)
}