Internal state object implementation

This should make it easier to convert blocks to Python objects by using
the contents of the state.  Instead of doing everything during the parsing.