processForgivingSelectorGroup method
Implementation
SelectorGroup? processForgivingSelectorGroup({required int terminatorKind}) {
final selectors = <Selector>[];
// We may already be in selector mode; preserve current state anyway.
final bool oldInSelector = tokenizer.inSelector;
tokenizer.inSelector = true;
while (!(_peekKind(terminatorKind) || _peekKind(TokenKind.END_OF_FILE))) {
final marked = _mark;
final selector = processSelector();
if (selector != null && !selector.hasInvalid) {
selectors.add(selector);
} else {
// Recover by consuming tokens until the next comma or terminator.
_restore(marked);
_consumeUntilForgivingSelectorBoundary(terminatorKind);
}
// Consume optional comma between list items (allow empty items).
_maybeEat(TokenKind.COMMA);
}
tokenizer.inSelector = oldInSelector;
if (selectors.isEmpty) return null;
return SelectorGroup(selectors);
}