function nodesToSegments (
    children,
    state
  ) {
    var segments = [];