void (@NotNull IElementType bracketType) { if (PyTokenTypes.OPEN_BRACES.contains(bracketType)) { myPendingClosingBraces.push(bracketType == PyTokenTypes.LBRACE ? PyTokenTypes.RBRACE : bracketType == PyTokenTypes.LBRACKET ? PyTokenTypes.RBRACKET : bracketType == PyTokenTypes.LPAR ? PyTokenTypes.RPAR : null); } else if (PyTokenTypes.CLOSE_BRACES.contains(bracketType) && myPendingClosingBraces.contains(bracketType)) { while (myPendingClosingBraces.peek() != bracketType) { myPendingClosingBraces.pop(); } IElementType expected = myPendingClosingBraces.pop(); assert expected == bracketType; } }