]> matita.cs.unibo.it Git - helm.git/blobdiff - matitaB/components/grafite_parser/grafiteParser.ml
1. ported to camlp5
[helm.git] / matitaB / components / grafite_parser / grafiteParser.ml
index 2c9f44554ad00a2edce564643be7c11ab880f81c..1010e2c83975fb7616bca27e58353b15887a3da1 100644 (file)
@@ -169,7 +169,8 @@ EXTEND
       | _ ->
        (*CSC: new NCicPp.status is the best I can do here without changing the
          result type *)
-       raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term (new NCicPp.status) params)) ]
+       raise (Invalid_argument ("malformed target parameter list 2\n" ^
+              NotationPp.pp_term (new NCicPp.status None ) params)) ]
   ];
   direction: [
     [ SYMBOL ">" -> `LeftToRight
@@ -220,7 +221,7 @@ EXTEND
                 G.NMacro(loc,
              G.NAutoInteractive (loc, (None,["depth",depth]@params))))
     | IDENT "intros" -> G.NMacro (loc, G.NIntroGuess loc)
-    | IDENT "check"; t = term -> G.NMacro(loc,G.NCheck (loc,t))
+    | IDENT "check"; t = tactic_term -> G.NMacro(loc,G.NCheck (loc,t))
     | IDENT "screenshot"; fname = QSTRING -> 
         G.NMacro(loc,G.Screenshot (loc, fname))
     | IDENT "cases"; what = tactic_term ; where = pattern_spec ->
@@ -535,7 +536,8 @@ EXTEND
      ]];
 
   grafite_ncommand: [ [
-      IDENT "qed" -> G.NQed loc
+      IDENT "qed" ;  b = OPT SYMBOL "-" -> 
+        let b = match b with None -> true | Some _ -> false in G.NQed (loc,b)
     | nflavour = ntheorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
       body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
         G.NObj (loc, N.Theorem (nflavour, name, typ, body,`Regular))
@@ -575,11 +577,11 @@ EXTEND
          G.NUnivConstraint (loc,u1,u2)
     | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term ->
         G.UnificationHint (loc, t, n)
-    | IDENT "coercion"; name = IDENT; SYMBOL ":"; ty = term; 
+    | IDENT "coercion"; name = IDENT; spec = OPT [ SYMBOL ":"; ty = term; 
         SYMBOL <:unicode<def>>; t = term; "on"; 
         id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
-        "to"; target = term ->
-          G.NCoercion(loc,name,t,ty,(id,source),target)     
+        "to"; target = term -> t,ty,(id,source),target ] ->
+        G.NCoercion(loc,name,spec)
     | IDENT "record" ; (params,name,ty,fields) = record_spec ->
         G.NObj (loc, N.Record (params,name,ty,fields))
     | IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with"; 
@@ -640,9 +642,9 @@ class type g_status =
   method parser_db: db
  end
 
-class virtual status =
+class virtual status uid =
  object(self)
-  inherit CicNotationParser.status ~keywords:[]
+  inherit CicNotationParser.status uid ~keywords:[]
   val mutable db = None (* mutable only to initialize it :-( *)
   method parser_db = match db with None -> assert false | Some x -> x
   method set_parser_db v = {< db = Some v >}
@@ -662,7 +664,8 @@ let extend status l1 action =
 ;;
 
 
-let parse_statement status = 
+let parse_statement status =
+  status#reset_loctable (); 
   parse_statement status#parser_db
 
 (* vim:set foldmethod=marker: *)