interruptedBy method

BlockSyntax? interruptedBy(
  1. BlockParser parser
)

Returns the block which interrupts current syntax parsing if there is one, otherwise returns null.

Make sure to check if parser isDone is false first.

Implementation

BlockSyntax? interruptedBy(BlockParser parser) {
  for (final syntax in parser.blockSyntaxes) {
    if (syntax.canParse(parser) && syntax.canEndBlock(parser)) {
      return syntax;
    }
  }
  return null;
}