openFenceAfter function
Whether a fence opened in lines is still open after the last line.
The one fence-tracking loop shared by the parser's neighbours (segment splitting, the streaming reveal), so they agree with the parser about where a fence ends.
Implementation
FenceOpen? openFenceAfter(Iterable<String> lines) {
FenceOpen? open;
for (final line in lines) {
final current = open;
if (current != null) {
if (isFenceClose(line, current)) {
open = null;
}
} else {
open = fenceOpen(line.trimLeft());
}
}
return open;
}