Parser- with error codes

Hopefully not such a disgrace as the last commit
Still some cases where I don't check for validity of "advance"