Commit 47f8c8f7 authored by Pietro Abate's avatar Pietro Abate

[r2003-05-26 20:59:50 by cvscast] bug for file inclusion

Original author: cvscast
Date: 2003-05-26 20:59:50+00:00
parent b3a28b6b
......@@ -93,6 +93,10 @@ let char_list loc s =
let include_stack = ref []
let protect_exn f g =
try let x = f () in g (); x
with e -> g (); raise e
EXTEND
GLOBAL: top_phrases prog expr pat regexp const;
......@@ -122,14 +126,17 @@ EXTEND
if List.mem s !include_stack then []
else (
include_stack := s :: !include_stack;
let chan = open_in s in
Location.push_source (`File s);
let input = Stream.of_channel chan in
let l = Grammar.Entry.parse prog input in
close_in chan;
Location.pop_source ();
include_stack := List.tl !include_stack;
l
protect_exn
(fun () ->
let chan = open_in s in
let input = Stream.of_channel chan in
let l = Grammar.Entry.parse prog input in
close_in chan;
l)
(fun () ->
Location.pop_source ();
include_stack := List.tl !include_stack)
)
] |
[ e = expr -> [ mk loc (EvalStatement e) ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment