List<PsiStatement> (PsiStatement startExclusive, PsiStatement endExclusive) { List<PsiStatement> statements = new ArrayList<>(); PsiStatement current = PsiTreeUtil.getNextSiblingOfType(startExclusive, PsiStatement.class); while (current != endExclusive && current != null) { statements.add(current); current = PsiTreeUtil.getNextSiblingOfType(current.getNextSibling(), PsiStatement.class); } return statements; }