Remove 'retmisc' hack + implement state remembering in state machine

This is a more generic solution, and should ease the implementation of
"proper" <!DOCTYPE ..> parsing. (Should I decide to go on with that)

This change does not affect performance, and only increases the size
with 50 bytes or so.
5 files changed