Changed a bit how syntax error messages are formulated.
Resolved a warning.
This commit is contained in:
parent
af48efe195
commit
ffb3d05864
@ -100,14 +100,14 @@ module Make (IO: IO)
|
|||||||
None ->
|
None ->
|
||||||
if Lexer.Token.is_eof invalid then ""
|
if Lexer.Token.is_eof invalid then ""
|
||||||
else let invalid_lexeme = Lexer.Token.to_lexeme invalid in
|
else let invalid_lexeme = Lexer.Token.to_lexeme invalid in
|
||||||
Printf.sprintf ", before \"%s\"" invalid_lexeme
|
Printf.sprintf ", at \"%s\"" invalid_lexeme
|
||||||
| Some valid ->
|
| Some valid ->
|
||||||
let valid_lexeme = Lexer.Token.to_lexeme valid in
|
let valid_lexeme = Lexer.Token.to_lexeme valid in
|
||||||
let s = Printf.sprintf ", after \"%s\"" valid_lexeme in
|
let valid = Printf.sprintf ", after \"%s\"" valid_lexeme in
|
||||||
if Lexer.Token.is_eof invalid then s
|
if Lexer.Token.is_eof invalid then valid
|
||||||
else
|
else
|
||||||
let invalid_lexeme = Lexer.Token.to_lexeme invalid in
|
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 header = header ^ trailer in
|
||||||
let msg =
|
let msg =
|
||||||
header ^ (if msg = "" then ".\n" else ":\n" ^ msg)
|
header ^ (if msg = "" then ".\n" else ":\n" ^ msg)
|
||||||
|
@ -273,8 +273,8 @@ module Make (Lexer: Lexer.S)
|
|||||||
let cin = open_in source in
|
let cin = open_in source in
|
||||||
let lexbuf = Lexing.from_channel cin in
|
let lexbuf = Lexing.from_channel cin in
|
||||||
let () =
|
let () =
|
||||||
lexbuf.Lexing.lex_curr_p <-
|
let open Lexing in
|
||||||
{lexbuf.Lexing.lex_curr_p with pos_fname = source}
|
lexbuf.lex_curr_p <- {lexbuf.lex_curr_p with pos_fname=source}
|
||||||
and options = (options :> Preprocessor.EvalOpt.options) in
|
and options = (options :> Preprocessor.EvalOpt.options) in
|
||||||
match Preprocessor.Preproc.lex options lexbuf with
|
match Preprocessor.Preproc.lex options lexbuf with
|
||||||
Stdlib.Ok _ as ok -> ok
|
Stdlib.Ok _ as ok -> ok
|
||||||
|
Loading…
Reference in New Issue
Block a user