lexer: Factor out scan error messages into new function.