parseLabels method

List<String> parseLabels(
  1. TokenIterator iterator
)

Implementation

List<String> parseLabels(TokenIterator iterator) {
  final labels = <String>[];
  iterator.moveNext();

  while (iterator.hasNext()) {
    if (match(iterator, TokenKind.closingCurlyBrace)) {
      iterator.moveNext();
      break;
    }

    throwErrorIfDoesntMatch(iterator, TokenKind.issueText);
    labels.add(iterator.current.lexeme);
    iterator.moveNext();

    if (match(iterator, TokenKind.comma)) {
      iterator.moveNext();
    }
  }
  return labels;
}