static int findBestLineToScrollTo (StringArray lines, StringRef className) { for (auto line : lines) { if (line.contains ("struct " + className) || line.contains ("class " + className)) { auto index = lines.indexOf (line); if (isDivider (lines[index - 1])) return index - 1; if (isEndOfCommentBlock (lines[index - 1])) { auto blockStartIndex = getIndexOfCommentBlockStart (lines, index - 1); if (blockStartIndex > 0 && isDivider (lines [blockStartIndex - 1])) return blockStartIndex - 1; return blockStartIndex; } return lines.indexOf (line); } } return 0; }
char *Script::readLine(char *buf, size_t bufSize) { bool inBlockComment = false; bool ignoreLine = true; char *line = 0; do { line = readLineIntern(buf, bufSize); if (line == 0) { return 0; } if (line[0] == '\0') continue; ignoreLine = false; line = Common::ltrim(line); if (isCommentLine(line)) { // ignore this line ignoreLine = true; } else if (isStartOfCommentBlock(line)) { // mark this and the following lines as comment inBlockComment = true; } else if (isEndOfCommentBlock(line)) { // comment is finished, so stop ignoring inBlockComment = false; // the current line must be skipped, though, // as it contains the end-of-comment marker ignoreLine = true; } } while (inBlockComment || ignoreLine); return line; }