fluidattacks-blends-domain 0.17.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::{
    query::label_text,
    syntax::{builders::comment::build_comment_node, SyntaxGraphArgs, SyntaxGraphError},
    utilities::text_nodes::node_to_str,
    NodeId,
};
use alloc::borrow::ToOwned;

#[expect(
    clippy::unnecessary_wraps,
    reason = "the signature must match the reader dispatch table"
)]
pub fn reader(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
    let graph = args.ast_graph;

    let comment = label_text(graph, n_id).map_or_else(|| node_to_str(graph, n_id), str::to_owned);

    Ok(Some(build_comment_node(args, n_id, comment)))
}