raise (HExtlib.Localized
(floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
-type parsable = Grammar.parsable
+type parsable = Grammar.parsable * Ulexing.lexbuf
let parsable_statement status buf =
let grammar = CicNotationParser.level2_ast_grammar status in
- Grammar.parsable grammar (Obj.magic buf)
+ Grammar.parsable grammar (Obj.magic buf), buf
let parse_statement grafite_parser parsable =
exc_located_wrapper
- (fun () -> (Grammar.Entry.parse_parsable (Obj.magic grafite_parser) parsable))
+ (fun () -> (Grammar.Entry.parse_parsable (Obj.magic grafite_parser) (fst parsable)))
+
+let strm_of_parsable (_,buf) = buf
let add_raw_attribute ~text t = N.AttributedTerm (`Raw text, t)
function strip_tags(tagname,classname)
{
var tags = unlocked.getElementsByTagName(tagname);
- var tlen = tags.length; // preserving the value from removeChild operations
if (is_defined(classname)) {
tags = filterByClass(tags,classname);
}
+ var tlen = tags.length; // preserving the value from removeChild operations
for (i = 0; i < tlen; i++) {
var children = tags[i].childNodes;
for (j = 0; j < children.length; j++) {
and eval_from_stream ~compiling ~asserted ~include_paths ?do_heavy_checks status str cb =
let matita_debug = Helm_registry.get_bool "matita.debug" in
- let rec loop asserted status =
- let asserted,stop,status =
+ let rec loop asserted status str =
+ let asserted,stop,status,str =
try
let cont =
try Some (get_ast status ~compiling ~asserted ~include_paths str)
with End_of_file -> None in
match cont with
- | None -> asserted, true, status
+ | None -> asserted, true, status, str
| Some (asserted,ast) ->
(* pp_ast_statement status ast; *)
cb status ast;
let status =
eval_ast ~include_paths ?do_heavy_checks status ("",0,ast)
in
- asserted, false, status
+ let str =
+ match ast with
+ (GrafiteAst.Executable
+ (_,GrafiteAst.NCommand
+ (_,(GrafiteAst.Include _ | GrafiteAst.Notation _)))) ->
+ GrafiteParser.parsable_statement status
+ (GrafiteParser.strm_of_parsable str)
+ | _ -> str
+ in
+ asserted, false, status, str
with exn when not matita_debug ->
prerr_endline ("EnrichedWithStatus: " ^ Printexc.to_string exn);
raise (EnrichedWithStatus (exn, status))
in
- if stop then asserted,status else loop asserted status
+ if stop then asserted,status else loop asserted status str
in
- loop asserted status
+ loop asserted status str
and compile ~compiling ~asserted ~include_paths ~outch ?uid fname =
if List.mem fname compiling then raise (CircularDependency fname);