If you try running the following:
You'll get an infinite loop around enumCaseStats in the parser, this is very similar to the issue that #2270 fixed for the REPL.
I'm not sure what the correct fix is here, but I'll note that other while loops in the parser check an exitOnError flag, I assume that this is to avoid this sort of things.