private void readNext()
{
try
{
next = tokens.MoveNext() ? tokens.Current : null;
}
catch (Exception)
{
// If an exception is encountered scanning,
// re-initialize the enumerator (as soon as MoveNext
// throws an exception the previous enumerator
// appears to switch to 'EOF').
// This is to support recovery from typos in the REPL.
initTokens(s.Recover());
throw;
}
}