diff options
Diffstat (limited to 'otherlibs/labltk/browser')
-rw-r--r-- | otherlibs/labltk/browser/lexical.ml | 2 | ||||
-rw-r--r-- | otherlibs/labltk/browser/typecheck.ml | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/otherlibs/labltk/browser/lexical.ml b/otherlibs/labltk/browser/lexical.ml index a2573ef7c..72f1957ec 100644 --- a/otherlibs/labltk/browser/lexical.ml +++ b/otherlibs/labltk/browser/lexical.ml @@ -39,6 +39,8 @@ let tag ?(start=tstart) ?(stop=tend) tw = let tpos c = (Text.index tw ~index:start, [`Char c]) in let text = Text.get tw ~start ~stop in let buffer = Lexing.from_string text in + Location.init buffer ""; + Location.input_name := ""; List.iter tags ~f:(fun tag -> Text.tag_remove tw ~start ~stop ~tag); let last = ref (EOF, 0, 0) in diff --git a/otherlibs/labltk/browser/typecheck.ml b/otherlibs/labltk/browser/typecheck.ml index 890fd195b..d5347ef53 100644 --- a/otherlibs/labltk/browser/typecheck.ml +++ b/otherlibs/labltk/browser/typecheck.ml @@ -46,8 +46,12 @@ let preprocess ~pp ~ext text = exception Outdated_version let parse_pp ~parse ~wrap ~ext text = + Location.input_name := ""; match !Clflags.preprocessor with - None -> parse (Lexing.from_string text) + None -> + let buffer = Lexing.from_string text in + Location.init buffer ""; + parse buffer | Some pp -> let tmpfile = preprocess ~pp ~ext text in let ast_magic = @@ -72,7 +76,9 @@ let parse_pp ~parse ~wrap ~ext text = failwith "Ocaml and preprocessor have incompatible versions" | _ -> seek_in ic 0; - parse (Lexing.from_channel ic) + let buffer = Lexing.from_channel ic in + Location.init buffer ""; + parse buffer in close_in ic; Sys.remove tmpfile; |