merge method
Add a span. Merges touching spans with the same attribute or type.
Spans touching span
with an equal AttributeSpan.attribute will be
merged.
Implementation
SpanList merge(AttributeSpan span) {
final touching = _spans.where(
(s) => s.range.touches(span.range) && s.attribute == span.attribute);
final toMerge = touching.followedBy([span]);
return _mergeSpans(span, toMerge);
}