use crate::syntax::fields::ruby::binary;
use crate::{
syntax::{
builders::binary_operation::build_binary_operation_node, SyntaxGraphArgs, SyntaxGraphError,
},
utilities::text_nodes::node_to_str,
NodeId,
};
pub fn reader(
args: &mut SyntaxGraphArgs<'_>,
n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
let graph = args.ast_graph;
let operator_id = args.required_field_alt(n_id, binary::OPERATOR)?;
let left_id = args.required_field_alt(n_id, binary::LEFT)?;
let right_id = args.required_field_alt(n_id, binary::RIGHT)?;
let operator = node_to_str(graph, operator_id);
build_binary_operation_node(args, n_id, operator, Some(left_id), Some(right_id)).map(Some)
}