createScanner method
Compiles patterns into a scanner that returns the leftmost match
across all of them.
Implementation
@override
Scanner createScanner(List<String> patterns) {
final compiled = [for (final p in patterns) _compile(p)];
final scanner = _DartScanner(compiled);
final combinable = compiled.every((p) => p.translated?.combinable ?? true);
final small = patterns.fold(0, (n, p) => n + p.length) <= combineMaxSource;
return supportsCombinedRegex &&
combinePatterns &&
combinable &&
small &&
compiled.length > 1
? _CombinedScanner(compiled, scanner)
: scanner;
}