Skip to content

Commit 2107733

Browse files
committed
Change matchers list from List to Iterable
1 parent e2e26f6 commit 2107733

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/src/parser.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const _kMatcherGroupPrefix = '__mg__';
55

66
class Parser {
77
Parser({
8-
required List<TextMatcher> matchers,
8+
required Iterable<TextMatcher> matchers,
99
required this.multiLine,
1010
required this.caseSensitive,
1111
required this.unicode,
@@ -19,14 +19,14 @@ class Parser {
1919
final bool unicode;
2020
final bool dotAll;
2121

22-
late List<TextMatcher> _matchers;
22+
late Iterable<TextMatcher> _matchers;
2323
final List<String> _matcherGroupNames = [];
2424
final List<List<int>> _matcherGroupRanges = [];
2525
late String _pattern;
2626

2727
List<TextMatcher> get matchers => List.unmodifiable(_matchers);
2828

29-
void update(List<TextMatcher> matchers) {
29+
void update(Iterable<TextMatcher> matchers) {
3030
assert(
3131
matchers.isNotEmpty,
3232
'At least one matcher must not specified.',
@@ -43,7 +43,7 @@ class Parser {
4343
final groupName = '$_kMatcherGroupPrefix$i';
4444
_matcherGroupNames.add(groupName);
4545

46-
var pattern = matchers[i].pattern;
46+
var pattern = matchers.elementAt(i).pattern;
4747
if (pattern.isEmpty) {
4848
// Expression that does not match anything.
4949
pattern = '(?!)';

lib/text_parser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TextParser {
2525
/// If [dotAll] is enabled, then the `.` pattern will match _all_
2626
/// characters, including line terminators.
2727
TextParser({
28-
required List<TextMatcher> matchers,
28+
required Iterable<TextMatcher> matchers,
2929
bool multiLine = false,
3030
bool caseSensitive = true,
3131
bool unicode = false,

0 commit comments

Comments
 (0)