fluidattacks-blends-domain 0.6.0

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::syntax::builders::named_argument::build_named_argument_node;
use crate::syntax::fields::java::element_value_pair;
use crate::syntax::{SyntaxGraphArgs, SyntaxGraphError};
use crate::utilities::text_nodes::node_to_str;
use crate::NodeId;

pub fn reader(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
    let key_id = args.required_field_alt(n_id, element_value_pair::KEY)?;
    let var_name = node_to_str(args.ast_graph, key_id);
    let val_id = args.required_field_alt(n_id, element_value_pair::VALUE)?;
    build_named_argument_node(args, n_id, Some(var_name), val_id).map(Some)
}