starting to get structured error messages working, and fix an off-by-1 bug in the lexer