]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/components/content_pres/cicNotationParser.ml
HUGE COMMIT:
[helm.git] / matita / components / content_pres / cicNotationParser.ml
index a9b558968829d8692683a63c09b9f4910545bd3a..53c60820c78632bd58f3b8527d697897537c92ff 100644 (file)
@@ -157,7 +157,7 @@ let extract_term_production status pattern =
     | Ast.Magic m -> aux_magic m
     | Ast.Variable v -> aux_variable v
     | t ->
-        prerr_endline (NotationPp.pp_term t);
+        prerr_endline (NotationPp.pp_term status t);
         assert false
   and aux_literal =
     function
@@ -375,10 +375,6 @@ let parse_level2_meta grammars lexbuf =
   exc_located_wrapper
     (fun () -> Grammar.Entry.parse grammars.level2_meta (Obj.magic lexbuf))
 
-let parse_term grammars lexbuf =
-  exc_located_wrapper
-    (fun () -> (Grammar.Entry.parse grammars.term (Obj.magic lexbuf)))
-
   (* create empty precedence level for "term" *)
 let initialize_grammars grammars =
   let dummy_action =
@@ -667,8 +663,10 @@ EXTEND
           in
           let rec find_arg name n = function 
             | [] ->
+                (* CSC: new NCicPp.status is the best I can do here
+                   without changing the return type *)
                 Ast.fail loc (sprintf "Argument %s not found"
-                  (NotationPp.pp_term name))
+                  (NotationPp.pp_term (new NCicPp.status) name))
             | (l,_) :: tl -> 
                 (match position_of name 0 l with
                 | None, len -> find_arg name (n + len) tl
@@ -818,7 +816,7 @@ class type g_status =
   method notation_parser_db: db
  end
 
-class status ~keywords:kwds =
+class status0 ~keywords:kwds =
  object
   val db = { grammars = initial_grammars kwds; keywords = kwds; items = [] }
   method notation_parser_db = db
@@ -828,6 +826,12 @@ class status ~keywords:kwds =
    = fun o -> {< db = o#notation_parser_db >}
  end
 
+class virtual status ~keywords:kwds =
+ object
+  inherit NCic.status
+  inherit status0 kwds
+ end
+
 let extend (status : #status) (CL1P (level1_pattern,precedence)) action =
         (* move inside constructor XXX *)
   let add1item status (level, level1_pattern, action) =
@@ -852,7 +856,7 @@ let extend (status : #status) (CL1P (level1_pattern,precedence)) action =
   let keywords = NotationUtil.keywords_of_term level1_pattern @
     status#notation_parser_db.keywords in
   let items = current_item :: status#notation_parser_db.items in 
-  let status = status#set_notation_parser_status (new status ~keywords) in
+  let status = status#set_notation_parser_status (new status0 ~keywords) in
   let status = status#set_notation_parser_db 
     {status#notation_parser_db with items = items} in
   List.fold_left add1item status items
@@ -865,8 +869,6 @@ let parse_level2_ast status =
   parse_level2_ast status#notation_parser_db.grammars 
 let parse_level2_meta status =
   parse_level2_meta status#notation_parser_db.grammars
-let parse_term status =
-  parse_term status#notation_parser_db.grammars
 
 let level2_ast_grammar status = 
   status#notation_parser_db.grammars.level2_ast_grammar