Some good refactorings (but uncomplete) around parser state.