diff options
author | Michel Mauny <Michel.Mauny@ensta.fr> | 2005-10-21 15:51:42 +0000 |
---|---|---|
committer | Michel Mauny <Michel.Mauny@ensta.fr> | 2005-10-21 15:51:42 +0000 |
commit | f0e54ce934e36dcce591750e999f330362df549a (patch) | |
tree | 39b9b7185358bee10e8a271cb6f1f7cfcabadc51 /camlp4 | |
parent | ddb16a83265049e08bc485a4e65fa7ee09a3a4d0 (diff) |
Fixed bug #3776
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7155 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'camlp4')
-rw-r--r-- | camlp4/top/camlp4_top.ml | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/camlp4/top/camlp4_top.ml b/camlp4/top/camlp4_top.ml index 6ade9881c..7b33eec6f 100644 --- a/camlp4/top/camlp4_top.ml +++ b/camlp4/top/camlp4_top.ml @@ -83,9 +83,9 @@ value wrap f shfn lb = lb.lex_curr_pos := lb.lex_curr_pos + 1; Some c } - }) - in - try f cs with + }) in + let parse_fun = f lb.lex_curr_p in + try parse_fun cs with [ Exc_located _ (Sys.Break as x) -> raise x | End_of_file as x -> raise x | x -> @@ -108,7 +108,7 @@ value wrap f shfn lb = value first_phrase = ref True; -value toplevel_phrase cs = +value toplevel_phrase pos cs = do { if Sys.interactive.val && first_phrase.val then do { first_phrase.val := False; @@ -121,7 +121,7 @@ value toplevel_phrase cs = } ; -value use_file cs = +value use_file pos cs = let v = Pcaml.input_file.val in let (bolpos,lnum,fname) = Pcaml.position.val in let restore = @@ -132,7 +132,7 @@ value use_file cs = } in do { Pcaml.input_file.val := Toploop.input_name.val; - bolpos.val := 0; lnum.val := 1; fname.val := Toploop.input_name.val; + bolpos.val := pos.pos_bol; lnum.val := pos.pos_lnum; fname.val := Toploop.input_name.val; try let (pl0, eoi) = loop () where rec loop () = |