X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fsoftware%2Fcomponents%2Fgrafite_parser%2FgrafiteParser.ml;h=378931c1471829b0a62bd5349b0db4d351458acf;hb=6beda5aa100b617b75d88a5a519b5022c99208a0;hp=50a373e49bf8b8389d0aad6836d2459c17f59a30;hpb=81d0d5a3aad863b991996c008f5c19076e771dbb;p=helm.git diff --git a/helm/software/components/grafite_parser/grafiteParser.ml b/helm/software/components/grafite_parser/grafiteParser.ml index 50a373e49..378931c14 100644 --- a/helm/software/components/grafite_parser/grafiteParser.ml +++ b/helm/software/components/grafite_parser/grafiteParser.ml @@ -30,6 +30,8 @@ let set_callback f = out := f module Ast = CicNotationPt +exception NoInclusionPerformed of string (* full path *) + type 'a localized_option = LSome of 'a | LNone of GrafiteAst.loc @@ -41,6 +43,7 @@ type ast_statement = GrafiteAst.statement type statement = + ?never_include:bool -> include_paths:string list -> LexiconEngine.status -> LexiconEngine.status * ast_statement localized_option @@ -75,7 +78,6 @@ EXTEND ]; reduction_kind: [ [ IDENT "normalize" -> `Normalize - | IDENT "reduce" -> `Reduce | IDENT "simplify" -> `Simpl | IDENT "unfold"; t = OPT tactic_term -> `Unfold t | IDENT "whd" -> `Whd ] @@ -687,17 +689,18 @@ EXTEND ]; statement: [ [ ex = executable -> - fun ~include_paths status -> status,LSome(GrafiteAst.Executable (loc,ex)) + fun ?(never_include=false) ~include_paths status -> status,LSome(GrafiteAst.Executable (loc,ex)) | com = comment -> - fun ~include_paths status -> status,LSome (GrafiteAst.Comment (loc, com)) + fun ?(never_include=false) ~include_paths status -> status,LSome (GrafiteAst.Comment (loc, com)) | (iloc,fname,mode) = include_command ; SYMBOL "." -> - fun ~include_paths status -> - let buri, fullpath = - DependenciesParser.baseuri_of_script ~include_paths fname + fun ?(never_include=false) ~include_paths status -> + let _root, buri, fullpath, _rrelpath = + Librarian.baseuri_of_script ~include_paths fname in let status = - LexiconEngine.eval_command status - (LexiconAst.Include (iloc,buri,mode,fullpath)) + if never_include then raise (NoInclusionPerformed fullpath) + else LexiconEngine.eval_command status + (LexiconAst.Include (iloc,buri,mode,fullpath)) in !out fname; status, @@ -706,7 +709,7 @@ EXTEND (loc,GrafiteAst.Command (loc,GrafiteAst.Include (iloc,buri)))) | scom = lexicon_command ; SYMBOL "." -> - fun ~include_paths status -> + fun ?(never_include=false) ~include_paths status -> let status = LexiconEngine.eval_command status scom in status,LNone loc | EOI -> raise End_of_file @@ -728,3 +731,4 @@ let exc_located_wrapper f = let parse_statement lexbuf = exc_located_wrapper (fun () -> (Grammar.Entry.parse statement (Obj.magic lexbuf))) +