Use enum types for parse state

This is mostly just to get the enums into the debug info so the code is easier to step through, but I suppose it adds some type safety as well.