]> matita.cs.unibo.it Git - helm.git/commitdiff
matitac now fails if it tries to insert a new alias
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 4 Sep 2006 13:31:55 +0000 (13:31 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 4 Sep 2006 13:31:55 +0000 (13:31 +0000)
matita/matitaEngine.ml
matita/matitaEngine.mli

index 40480995971d22f3cb14a1933382427718f25f7f..9d88777ac1b97b68fee16039d39aa7dcd32d9847 100644 (file)
@@ -98,9 +98,11 @@ let eval_ast ?do_heavy_checks ?clean_baseuri lexicon_status
  in
   ((new_grafite_status,new_lexicon_status),None)::intermediate_states
 
+exception TryingToAdd of string
+
 let eval_from_stream ~first_statement_only ~include_paths ?(prompt=false)
- ?do_heavy_checks ?clean_baseuri lexicon_status grafite_status
- str cb 
+ ?do_heavy_checks ?clean_baseuri ?(enforce_no_new_aliases=true)
lexicon_status grafite_status str cb 
 =
  let rec loop lexicon_status grafite_status statuses =
   let loop =
@@ -123,6 +125,18 @@ let eval_from_stream ~first_statement_only ~include_paths ?(prompt=false)
           let new_statuses =
            eval_ast ?do_heavy_checks ?clean_baseuri lexicon_status
             grafite_status ("",0,ast) in
+          if enforce_no_new_aliases then
+           List.iter 
+            (fun (_,alias) ->
+              match alias with
+                None -> ()
+              | Some (k,((v,_) as value)) ->
+                 let newtxt =
+                  DisambiguatePp.pp_environment
+                   (DisambiguateTypes.Environment.add k value
+                     DisambiguateTypes.Environment.empty)
+                 in
+                  raise (TryingToAdd newtxt)) new_statuses;
           let grafite_status,lexicon_status =
            match new_statuses with
               [] -> assert false
index 3fb5c7637540ea1df970c994157718633a0368f1..b20aa2bd503ddb0835d2880a6c9e8c9c5b5df363 100644 (file)
@@ -48,6 +48,7 @@ val eval_from_stream :
   ?prompt:bool ->
   ?do_heavy_checks:bool ->
   ?clean_baseuri:bool ->
+  ?enforce_no_new_aliases:bool -> (* default true *)
   LexiconEngine.status ->
   GrafiteTypes.status ->
   Ulexing.lexbuf ->