docs: function getCommentRanges(text, pos, trailing) {
          var result;
          var collecting = trailing || pos === 0;
          while (pos < text.length) {
              var ch = text.charCodeAt(pos);
              switch (ch) {
                  case 13 /* carriageReturn */:
                      if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
                          pos++;
                      }
                  case 10 /* lineFeed */:
                      pos++;
                      if (trailing) {
                          return result;
                      }
                      collecting = true;
                      if (result && result.length) {
                          ts.lastOrUndefined(result).hasTrailingNewLine = true;
                      }
                      continue;
                  case 9 /* tab */:
                  case 11 /* verticalTab */:
                  case 12 /* formFeed */:
                  case 32 /* space */:
                      pos++;
                      continue;
                  case 47 /* slash */:
                      var nextChar = text.charCodeAt(pos + 1);
                      var hasTrailingNewLine = false;
                      if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) {
                          var kind = nextChar === 47 /* slash */ ? 2 /* SingleLineCommentTrivia */ : 3 /* MultiLineCommentTrivia */;
                          var startPos = pos;
                          pos += 2;
                          if (nextChar === 47 /* slash */) {
                              while (pos < text.length) {
                                  if (isLineBreak(text.charCodeAt(pos))) {
                                      hasTrailingNewLine = true;
                                      break;
                                  }
                                  pos++;
                              }
                          }
                          else {
                              while (pos < text.length) {
                                  if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
                                      pos += 2;
                                      break;
                                  }
                                  pos++;
                              }
                          }
                          if (collecting) {
                              if (!result) {
                                  result = [];
                              }
                              result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine, kind: kind });
                          }
                          continue;
                      }
                      break;
                  default:
                      if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch))) {
                          if (result && result.length && isLineBreak(ch)) {
                              ts.lastOrUndefined(result).hasTrailingNewLine = true;
                          }
                          pos++;
                          continue;
                      }
                      break;
              }
              return result;
          }
          return result;
      }