private IASTNode getNextSiblingOrPreprocessorNode(IASTNode node) { int endOffset = endOffset(node); IASTTranslationUnit ast = node.getTranslationUnit(); IASTPreprocessorStatement[] preprocessorStatements = ast.getAllPreprocessorStatements(); int low = 0; int high = preprocessorStatements.length; while (low < high) { int mid = (low + high) / 2; IASTNode statement = preprocessorStatements[mid]; if (statement.isPartOfTranslationUnitFile() && offset(statement) > endOffset) { high = mid; } else { low = mid + 1; } } if (high < preprocessorStatements.length) { IASTNode statement = preprocessorStatements[high]; if (statement.isPartOfTranslationUnitFile()) { int offset = offset(statement); if (!doesRegionContainNode(ast, endOffset, offset - endOffset)) { return statement; } } } return getNextSiblingNode(node); }