fluidattacks-blends-domain 0.35.0

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::{
    syntax::{builders::literal::build_literal_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 value = match node_to_str(args.ast_graph, n_id) {
        text if text.is_empty() => "boolean".to_owned(),
        text => text,
    };
    Ok(Some(build_literal_node(
        args,
        n_id,
        value,
        "bool".to_owned(),
    )))
}