List<Block> () { final List<Block> result = new ArrayList<>(); ASTNode child = myNode.getFirstChildNode(); while (child != null) { if (!(child instanceof PsiWhiteSpace)) { if (child.getElementType() == PropertiesElementTypes.PROPERTIES_LIST) { ASTNode propertyNode = child.getFirstChildNode(); while (propertyNode != null) { if (propertyNode.getElementType() == PropertiesElementTypes.PROPERTY) { collectPropertyBlock(propertyNode, result); } else if (PropertiesTokenTypes.END_OF_LINE_COMMENT.equals(propertyNode.getElementType()) || PropertiesTokenTypes.BAD_CHARACTER.equals(propertyNode.getElementType())) { result.add(new PropertyBlock(propertyNode, null)); } propertyNode = propertyNode.getTreeNext(); } } else if (PropertiesTokenTypes.BAD_CHARACTER.equals(child.getElementType())) { result.add(new PropertyBlock(child, null)); } } if (PropertiesTokenTypes.END_OF_LINE_COMMENT.equals(child.getElementType())) { result.add(new PropertyBlock(child, null)); } child = child.getTreeNext(); } return result; }