X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2FmatitaScript.ml;h=b84180037b5ad92716267ce1022b19cc74e72550;hb=4e7e01cd771c07b3605ba54d3853ac34a02cb86d;hp=6aae0020da0d3a0a6b2091b46f179dac8ea40890;hpb=b505ea98f76ba6defb31be73a6871c62136e5747;p=helm.git diff --git a/matita/matita/matitaScript.ml b/matita/matita/matitaScript.ml index 6aae0020d..b84180037 100644 --- a/matita/matita/matitaScript.ml +++ b/matita/matita/matitaScript.ml @@ -118,9 +118,14 @@ let eval_nmacro include_paths (buffer : GText.buffer) guistuff grafite_status us let status = script#grafite_status in let _,_,menv,subst,_ = status#obj in let ctx = - try let _,(_,ctx,_) = List.hd menv in ctx - with Failure "hd" -> [] - in + match Continuationals.Stack.head_goals status#stack with + [] -> [] + | g::tl -> + if tl <> [] then + HLog.warn + "Many goals focused. Using the context of the first one\n"; + let _, ctx, _ = NCicUtils.lookup_meta g menv in + ctx in let m, s, status, t = GrafiteDisambiguate.disambiguate_nterm status None ctx menv subst (parsed_text,parsed_text_length, @@ -188,7 +193,10 @@ and eval_statement include_paths (buffer : GText.buffer) guistuff match statement with | `Raw text -> if Pcre.pmatch ~rex:only_dust_RE text then raise Margin; - let ast = MatitaEngine.toplevel grafite_status include_paths text in + let strm = + GrafiteParser.parsable_statement grafite_status + (Ulexing.from_utf8_string text) in + let ast = MatitaEngine.get_ast grafite_status include_paths strm in ast, text | `Ast (st, text) -> st, text in @@ -657,9 +665,10 @@ object (self) method eos = let rec is_there_only_comments lexicon_status s = if Pcre.pmatch ~rex:only_dust_RE s then raise Margin; - match - GrafiteParser.parse_statement lexicon_status (Ulexing.from_utf8_string s) - with + let strm = + GrafiteParser.parsable_statement lexicon_status + (Ulexing.from_utf8_string s)in + match GrafiteParser.parse_statement lexicon_status strm with | GrafiteAst.Comment (loc,_) -> let _,parsed_text_length = MatitaGtkMisc.utf8_parsed_text s loc in (* CSC: why +1 in the following lines ???? *)