Skip to content

Commit

Permalink
fix PR#4814
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.11@9293 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
Jacques Garrigue committed Jun 8, 2009
1 parent a5b6201 commit 75d94ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions otherlibs/labltk/browser/lexical.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions otherlibs/labltk/browser/typecheck.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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;
Expand Down

0 comments on commit 75d94ba

Please sign in to comment.