final IASTPreprocessorStatement[] preprocessorStatements = ast.getAllPreprocessorStatements();
int low = 0;
int high = preprocessorStatements.length;
while (low < high) {
final int mid = (low + high) / 2;
final IASTNode statement = preprocessorStatements[mid];
if (statement.isPartOfTranslationUnitFile() && (offset(statement) > endOffset)) {
high = mid;
} else {
low = mid + 1;
}
}
final IASTNode statement = high < preprocessorStatements.length ? preprocessorStatements[high] : null;
final IASTNode originalSibling = getNextSiblingNode(node);
final IASTNode sibling = originalSibling == null ? null : getReplacementNode(originalSibling);
if ((statement == null) || !statement.isPartOfTranslationUnitFile()) {
return sibling;
}
if (sibling == null) {
final IASTNode parent = node.getParent();
if (endOffset(parent) <= offset(statement)) {
return null;
}
return statement;
}