add smcup/rmcup parsing
add reset_state function to parser

Not yet used, since it will require some changes to how dtattach and
dtmaster interact.