in lib/BridgingHeader.js [62:117]
BridgingHeader.prototype.__parseForBridgingHeader = function (text) {
let i = 0;
const list = [];
let type = 'code';
let start = 0;
while (i < text.length) {
switch (type) {
case 'comment':
if (i + 1 < text.length && text[i] === '*' && text[i + 1] === '/') {
i += 2;
list.push({ type, code: text.slice(start, i) });
type = 'code';
start = i;
} else {
i += 1;
}
break;
case 'line-comment':
if (i < text.length && text[i] === '\n') {
i += 1;
list.push({ type, code: text.slice(start, i) });
type = 'code';
start = i;
} else {
i += 1;
}
break;
case 'code':
default:
if (i + 1 < text.length && text[i] === '/' && text[i + 1] === '*') { // comment
if (start < i) {
list.push({ type, code: text.slice(start, i) });
}
type = 'comment';
start = i;
} else if (i + 1 < text.length && text[i] === '/' && text[i + 1] === '/') { // line comment
if (start < i) {
list.push({ type, code: text.slice(start, i) });
}
type = 'line-comment';
start = i;
} else if (i < text.length && text[i] === '\n') {
i += 1;
list.push({ type, code: text.slice(start, i) });
start = i;
} else {
i += 1;
}
break;
}
}
if (start < i) {
list.push({ type, code: text.slice(start, i) });
}
return list;
};