finishMultiLineComment method

Token finishMultiLineComment()

Implementation

Token finishMultiLineComment() {
  var nesting = 1;
  do {
    var ch = _nextChar();
    if (ch == 0) {
      return _errorToken();
    } else if (ch == TokenChar.ASTERISK) {
      if (_maybeEatChar(TokenChar.SLASH)) {
        nesting--;
      }
    } else if (ch == TokenChar.SLASH) {
      if (_maybeEatChar(TokenChar.ASTERISK)) {
        nesting++;
      }
    }
  } while (nesting > 0);

  if (_inString) {
    return next();
  } else {
    return _finishToken(TokenKind.COMMENT);
  }
}