set the filename in the lexbuf
This commit is contained in:
parent
586bfbdc04
commit
e02a18b4d7
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue