In the console REPL, we can see that input is parsed in a certain way, that is not equivalent to simply calling ToExpression on the input string. From math.exe using Mathematica 13.1:
In[1]:= Print@"foo"\[NewLine]Print@"bar"
foo
In[2]:= DownValues[In][[1]]
Out[2]= HoldPattern[In[1]] :> Print["foo"]
In[3]:= ToExpression[InString[1]]
foo
bar
As we can see, the Print["bar"] is discarded when assigning In[1], but not when assigning InString[1], and calling ToExpression on InString[1] evaluates both print statements. What is the meaning of this, and is there a function analogous to ToExpression which reproduces the former behavior?
Print@"foo"; Print@"bar"
instead. $\endgroup$InString[1]
is a string. $\endgroup$ToExpression[InString[1]]
only prints "foo" and not "bar", which makes sense - I've tried on Windows, Linux, and Mac and cannot reproduce $\endgroup$