set the filename in the lexbuf

This commit is contained in:
Jeremie Dimino 2013-07-12 12:02:18 +01:00
parent 586bfbdc04
commit e02a18b4d7
1 changed files with 15 additions and 11 deletions

View File

@ -194,6 +194,7 @@ let input_name = "//toplevel//"
let lexbuf_of_string eof str = let lexbuf_of_string eof str =
let pos = ref 0 in let pos = ref 0 in
let lexbuf =
Lexing.from_function Lexing.from_function
(fun buf len -> (fun buf len ->
if !pos = String.length str then begin if !pos = String.length str then begin
@ -205,6 +206,9 @@ let lexbuf_of_string eof str =
pos := !pos + len; pos := !pos + len;
len len
end) end)
in
Location.init lexbuf input_name;
lexbuf
let mkloc loc = let mkloc loc =
(loc.Location.loc_start.Lexing.pos_cnum, (loc.Location.loc_start.Lexing.pos_cnum,