scan method

  1. @override
bool scan(
  1. Pattern pattern
)
override

If pattern matches at the current position of the string, scans forward until the end of the match.

Returns whether or not pattern matched.

Implementation

@override
bool scan(Pattern pattern) {
  if (!super.scan(pattern)) return false;

  final newlines = _newlinesIn(lastMatch![0]!);
  _line += newlines.length;
  if (newlines.isEmpty) {
    _column += (lastMatch![0])!.length;
  } else {
    _column = (lastMatch![0])!.length - newlines.last.end;
  }

  return true;
}