Fixes #1011
In preparation for an upcoming change Makes for nicer error messages, complaining about EOF instead of newlines The hack had to be kept for the lexer raw mode to avoid a bug; see the relevant code comment for more info.