HPCC-10359 Embedded R fails if there are ^M characters in the source

This is likely to be the case when submitting from the ECL IDE.

We have also seen reports of Python failing for similar reasons, though I have
not reproduced them (it may depend on the python version, I suppose).

At the same time, improve the error reporting and recovery in embedded R.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>