X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fgrafite_parser%2FgrafiteParser.ml;h=27748245654989ef634ad940b51a6b026ec3f6c7;hb=5780dca4cfcee57e680213186cf3eaae402b6c88;hp=688e21b8ac1a89b703c2380c4f9b039792219df3;hpb=e4753fc1a4dbc9a6d2144383d805ec626fa93070;p=helm.git diff --git a/helm/software/components/grafite_parser/grafiteParser.ml b/helm/software/components/grafite_parser/grafiteParser.ml index 688e21b8a..277482456 100644 --- a/helm/software/components/grafite_parser/grafiteParser.ml +++ b/helm/software/components/grafite_parser/grafiteParser.ml @@ -79,7 +79,7 @@ let mk_rec_corec ind_kind defs loc = let name,ty = match defs with | (params,(N.Ident (name, None), ty),_,_) :: _ -> - let ty = match ty with Some ty -> ty | None -> N.Implicit in + let ty = match ty with Some ty -> ty | None -> N.Implicit `JustOne in let ty = List.fold_right (fun var ty -> N.Binder (`Pi,var,ty) @@ -209,11 +209,11 @@ EXTEND let deannotate = function | N.AttributedTerm (_,t) | t -> t in match deannotate params with - | N.Implicit -> [false] + | N.Implicit _ -> [false] | N.UserInput -> [true] | N.Appl l -> List.map (fun x -> match deannotate x with - | N.Implicit -> false + | N.Implicit _ -> false | N.UserInput -> true | _ -> raise (Invalid_argument "malformed target parameter list 1")) l | _ -> raise (Invalid_argument ("malformed target parameter list 2\n" ^ CicNotationPp.pp_term params)) ] @@ -262,8 +262,12 @@ EXTEND G.NLetIn (loc,where,t,name) | kind = nreduction_kind; p = pattern_spec -> G.NReduce (loc, kind, p) - | IDENT "nrewrite"; dir = direction; what = tactic_term ; where = pattern_spec -> + | IDENT "nrewrite"; dir = direction; what = tactic_term ; where = pattern_spec -> G.NRewrite (loc, dir, what, where) + | IDENT "ntry"; tac = SELF -> G.NTry (loc,tac) + | IDENT "nrepeat"; tac = SELF -> G.NRepeat (loc,tac) + | LPAREN; l = LIST1 SELF; RPAREN -> G.NBlock (loc,l) + | IDENT "nassumption" -> G.NAssumption loc | SYMBOL "#"; n=IDENT -> G.NIntro (loc,n) | SYMBOL "#"; SYMBOL "_" -> G.NIntro (loc,"_") | SYMBOL "*" -> G.NCase1 (loc,"_") @@ -785,7 +789,7 @@ EXTEND G.NObj (loc, N.Theorem (nflavour, name, typ, body)) | nflavour = ntheorem_flavour; name = IDENT; SYMBOL <:unicode> (* ≝ *); body = term -> - G.NObj (loc, N.Theorem (nflavour, name, N.Implicit, Some body)) + G.NObj (loc, N.Theorem (nflavour, name, N.Implicit `JustOne, Some body)) | IDENT "naxiom"; name = IDENT; SYMBOL ":"; typ = term -> G.NObj (loc, N.Theorem (`Axiom, name, typ, None)) | NLETCOREC ; defs = let_defs -> @@ -825,8 +829,17 @@ EXTEND G.NUnivConstraint (loc, strict,u1,u2) | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term -> G.UnificationHint (loc, t, n) + | IDENT "ncoercion"; name = IDENT; SYMBOL ":"; ty = term; + SYMBOL <:unicode>; t = term; "on"; + id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term; + "to"; target = term -> + G.NCoercion(loc,name,t,ty,(id,source),target) | IDENT "nrecord" ; (params,name,ty,fields) = record_spec -> G.NObj (loc, N.Record (params,name,ty,fields)) + | IDENT "ncopy" ; s = IDENT; IDENT "from"; u = URI; "with"; + m = LIST0 [ u1 = URI; SYMBOL <:unicode>; u2 = URI -> u1,u2 ] -> + G.NCopy (loc,s,NUri.uri_of_string u, + List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m) ]]; grafite_command: [ [ @@ -846,7 +859,7 @@ EXTEND | flavour = theorem_flavour; name = IDENT; SYMBOL <:unicode> (* ≝ *); body = term -> G.Obj (loc, - N.Theorem (flavour, name, N.Implicit, Some body)) + N.Theorem (flavour, name, N.Implicit `JustOne, Some body)) | IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term -> G.Obj (loc, N.Theorem (`Axiom, name, typ, None)) | LETCOREC ; defs = let_defs -> @@ -947,21 +960,23 @@ EXTEND status, LSome stm | (iloc,fname,normal,mode) = include_command ; SYMBOL "." -> fun ?(never_include=false) ~include_paths status -> + let _root, buri, fullpath, _rrelpath = + Librarian.baseuri_of_script ~include_paths fname in + if never_include then raise (NoInclusionPerformed fullpath) + else + begin let stm = - G.Executable (loc, G.Command (loc, G.Include (iloc, normal, fname))) - in + G.Executable + (loc, G.Command (loc, G.Include (iloc,normal,`OldAndNew,fname))) in !grafite_callback stm; - let _root, buri, fullpath, _rrelpath = - Librarian.baseuri_of_script ~include_paths fname - in let status = - if never_include then raise (NoInclusionPerformed fullpath) - else LE.eval_command status (L.Include (iloc,buri,mode,fullpath)) - in + LE.eval_command status (L.Include (iloc,buri,mode,fullpath)) in let stm = - G.Executable (loc, G.Command (loc, G.Include (iloc, normal, buri))) + G.Executable + (loc,G.Command (loc,G.Include (iloc,normal,`OldAndNew,buri))) in - status, LSome stm + status, LSome stm + end | scom = lexicon_command ; SYMBOL "." -> fun ?(never_include=false) ~include_paths status -> !lexicon_callback scom;