findBlockEnd method

bool findBlockEnd(
  1. Block block, {
  2. Position? blockEnd,
  3. Position? startPosition,
})

Searches the end of the block starting at the current position. block: specifies the block parameters: start, end, body. blockEnd: The end of the block is stored here. If null currentPosition is taken. startPosition: defines the start of the search. If null currentPosition is taken. Returns true: the block has been found.

Implementation

bool findBlockEnd(Block block,
    {Position? blockEnd, Position? startPosition}) {
  var rc = false;
  tempPosition.clone(startPosition ?? currentPosition);
  if (currentRegion.contains(tempPosition)) {
    final ixStop = currentRegion.end.column > 0
        ? currentRegion.end.line + 1
        : currentRegion.end.line;
    rc = traverseBlock(block.entries, tempPosition.line, 1, ixStop,
        blockEnd ?? currentPosition);
  }
  return rc;
}