function getSwaggerComments(data) {
    return new Promise(resolve => {
        if (data.length == 0) {
            return resolve(data);
        }

        let strToReturn = '';
        let stackComment1 = 0; // For type  //
        let stackComment2 = 0; // For type  /* */

        let buffer1 = ''; // For type  //
        let buffer2 = ''; // For type   /* */

        // Won't remove comments in strings
        let isStr1 = 0; // "
        let isStr2 = 0; // '
        let isStr3 = 0; // `

        try {
            for (let idx = 0; idx < data.length; ++idx) {
                let c = data[idx];

                if (stackComment1 == 0 && stackComment2 == 0) {
                    // Type '
                    if (c == "'" && (data[idx - 1] != '\\' || (data[idx - 1] == '\\' && data[idx - 2] == '\\')) && isStr1 == 1) isStr1 = 2;
                    if (c == "'" && (data[idx - 1] != '\\' || (data[idx - 1] == '\\' && data[idx - 2] == '\\')) && isStr1 == 0 && isStr2 == 0 && isStr3 == 0) isStr1 = 1;

                    // Type  "
                    if (c == '"' && (data[idx - 1] != '\\' || (data[idx - 1] == '\\' && data[idx - 2] == '\\')) && isStr2 == 1) isStr2 = 2;
                    if (c == '"' && (data[idx - 1] != '\\' || (data[idx - 1] == '\\' && data[idx - 2] == '\\')) && isStr1 == 0 && isStr2 == 0 && isStr3 == 0) isStr2 = 1;

                    // Type  `
                    if (c == '`' && (data[idx - 1] != '\\' || (data[idx - 1] == '\\' && data[idx - 2] == '\\')) && isStr3 == 1) isStr3 = 2;
                    if (c == '`' && (data[idx - 1] != '\\' || (data[idx - 1] == '\\' && data[idx - 2] == '\\')) && isStr1 == 0 && isStr2 == 0 && isStr3 == 0) isStr3 = 1;
                }

                // Type //
                if (c == '/' && data[idx + 1] == '/' && stackComment1 == 0 && stackComment2 == 0) stackComment1 = 1;
                if (c == '\n' && stackComment1 == 1) stackComment1 = 2;

                // Type  /* */
                if (c == '/' && data[idx + 1] == '*' && stackComment1 == 0 && stackComment2 == 0) stackComment2 = 1;
                if (c == '/' && data[idx - 1] == '*' && stackComment2 == 1) stackComment2 = 2;

                if (stackComment1 == 1 || stackComment1 == 2) {
                    // Keeps the comment being ignored. Like: //
                    buffer1 += c;
                } else if (stackComment2 == 1 || stackComment2 == 2) {
                    // Keeps the comment being ignored. Like: /* */
                    buffer2 += c;
                }

                if (stackComment1 == 2) {
                    stackComment1 = 0;
                    if (buffer1.includes('#swagger.')) {
                        strToReturn += ' ' + buffer1; // keeping the comment that has a swagger tag
                        buffer1 = '';
                    } else {
                        buffer1 = '';
                    }
                }

                if (stackComment2 == 2) {
                    stackComment2 = 0;
                    if (buffer2.includes('#swagger.')) {
                        strToReturn += ' ' + buffer2; // keeping the comment that has a swagger tag
                        buffer2 = '';
                    } else {
                        buffer2 = '';
                    }
                }

                if (isStr1 == 2) isStr1 = 0;
                if (isStr2 == 2) isStr2 = 0;
                if (isStr3 == 2) isStr3 = 0;

                if (idx == data.length - 1) {
                    strToReturn = strToReturn.replaceAll('  ', ' ').replaceAll('  ', ' ').replaceAll('  ', ' ').replaceAll('  ', ' ');
                    return resolve(strToReturn);
                }
            }
        } catch (err) {
            return resolve(strToReturn);
        }
    });
}
Return all "#swagger.*" in a string.
@param {string} data file content.