store parser state data when a scope is entered and restore it when the scope is left