[ocaml] standardise error message; tidy up lexer codes