Changed a bit how syntax error messages are formulated.

Resolved a warning.
This commit is contained in:
Christian Rinderknecht 2020-04-13 14:19:56 +02:00
parent af48efe195
commit ffb3d05864
2 changed files with 6 additions and 6 deletions

View File

@ -100,14 +100,14 @@ module Make (IO: IO)
None ->
if Lexer.Token.is_eof invalid then ""
else let invalid_lexeme = Lexer.Token.to_lexeme invalid in
Printf.sprintf ", before \"%s\"" invalid_lexeme
Printf.sprintf ", at \"%s\"" invalid_lexeme
| Some valid ->
let valid_lexeme = Lexer.Token.to_lexeme valid in
let s = Printf.sprintf ", after \"%s\"" valid_lexeme in
if Lexer.Token.is_eof invalid then s
let valid = Printf.sprintf ", after \"%s\"" valid_lexeme in
if Lexer.Token.is_eof invalid then valid
else
let invalid_lexeme = Lexer.Token.to_lexeme invalid in
Printf.sprintf "%s and before \"%s\"" s invalid_lexeme in
Printf.sprintf "at \"%s\", before %s" invalid_lexeme valid in
let header = header ^ trailer in
let msg =
header ^ (if msg = "" then ".\n" else ":\n" ^ msg)

View File

@ -273,8 +273,8 @@ module Make (Lexer: Lexer.S)
let cin = open_in source in
let lexbuf = Lexing.from_channel cin in
let () =
lexbuf.Lexing.lex_curr_p <-
{lexbuf.Lexing.lex_curr_p with pos_fname = source}
let open Lexing in
lexbuf.lex_curr_p <- {lexbuf.lex_curr_p with pos_fname=source}
and options = (options :> Preprocessor.EvalOpt.options) in
match Preprocessor.Preproc.lex options lexbuf with
Stdlib.Ok _ as ok -> ok