onMatch method

  1. @override
bool onMatch(
  1. InlineParser parser,
  2. Match match
)
override

Processes match, adding nodes to parser and possibly advancing parser.

Returns whether the caller should advance parser by match[0].length.

Implementation

@override
bool onMatch(InlineParser parser, Match match) {
  final runLength = match.group(0)!.length;
  final matchStart = parser.pos;
  final matchEnd = parser.pos + runLength - 1;
  if (!requiresDelimiterRun) {
    parser.openTag(TagState(parser.pos, matchEnd + 1, this, null));
    return true;
  }

  final delimiterRun = _DelimiterRun.tryParse(parser, matchStart, matchEnd);
  if (delimiterRun != null && delimiterRun.canOpen) {
    parser.openTag(TagState(parser.pos, matchEnd + 1, this, delimiterRun));
    return true;
  } else {
    parser.advanceBy(runLength);
    return false;
  }
}