Work around for yacc.restart()

Make sure the local state is updated to the top of the state stack
(which should be 0 after restart is called if we are continuing with
errok().
Error handing and unit test function.