Stockholm format parser/writer

This is in the new parse format that @ElDeveloper created in #235 so merge his first.
I agree with @wasade's comment here - there is a lot of code in this block, which will make it hard to test.