use generator to reduce memory usage
CRLF should be also treated as blank line
skip trailing blank lines