int (int indent, int index) { // insert the DEDENT before previous comments that have the same indent as the current token indent boolean foundComment = false; while(index > 0 && myTokenQueue.get(index - 1) instanceof PendingCommentToken commentToken) { if (commentToken.getIndent() != indent) { break; } foundComment = true; index--; if (index > 1 && myTokenQueue.get(index - 1).getType() == PyTokenTypes.LINE_BREAK && myTokenQueue.get(index - 2) instanceof PendingCommentToken) { index--; } } return foundComment ? index : myTokenQueue.size(); }