Fix PR4296: Add parser detection/error recovery for nested functions, from Serve Pavlov!