make the block-level parser line-based

now code segments also can be indented and can occur in lists etc
and the parse_lines method accepts a generator to read the lines from.