visitExtensibleArrow method

  1. @override
String visitExtensibleArrow(
  1. ExtensibleArrowNode node
)
override

Implementation

@override
String visitExtensibleArrow(ExtensibleArrowNode node) {
  final above = visit(node.content);
  final below = node.below != null ? visit(node.below!) : null;
  final dir = switch (node.direction) {
    ArrowDirection.right => "right arrow",
    ArrowDirection.left => "left arrow",
    ArrowDirection.both => "biArrowdirectional arrow",
    ArrowDirection.hookRight => "hook right arrow",
    ArrowDirection.hookLeft => "hook left arrow",
    ArrowDirection.rightDouble => "double right arrow",
    ArrowDirection.leftDouble => "double left arrow",
    ArrowDirection.bothDouble => "double biArrowdirectional arrow",
    ArrowDirection.mapsto => "maps to",
    ArrowDirection.equal => "long equals",
  };

  final buffer = StringBuffer(dir);
  if (above.trim().isNotEmpty) buffer.write(" labeled $above");
  if (below != null && below.trim().isNotEmpty) {
    buffer.write(" with $below below");
  }
  return buffer.toString();
}