ast, term_info.uri
let counter = ref ~-1
-let reset () = counter := ~-1;;
+let reset () =
+ counter := ~-1;
+ Hashtbl.clear level2_patterns32;
+ Hashtbl.clear interpretations
+;;
let fresh_id =
fun () ->
incr counter;
let remove_interpretation id =
(try
- let _, symbol, _, _ = Hashtbl.find level2_patterns32 id in
+ let dsc, symbol, _, _ = Hashtbl.find level2_patterns32 id in
let ids = Hashtbl.find interpretations symbol in
ids := List.filter ((<>) id) !ids;
Hashtbl.remove level2_patterns32 id;
aux true l1_pattern *)
let counter = ref ~-1
-let reset () = counter := ~-1;;
+let reset () =
+ counter := ~-1;
+ Hashtbl.clear level1_patterns21
+;;
let fresh_id =
fun () ->
incr counter;
let content = status.lexicon_content_rev in
let content' =
List.fold_right
- (fun cmd acc -> cmd :: (List.filter ((<>) cmd) acc))
+ (fun cmd acc ->
+ match cmd with
+ | LexiconAst.Alias _
+ | LexiconAst.Include _
+ | LexiconAst.Notation _ -> cmd :: (List.filter ((<>) cmd) acc)
+ | LexiconAst.Interpretation _ -> if List.exists ((=) cmd) acc then acc else cmd::acc)
cmds content
in
(* prerr_endline ("new lexicon content: " ^ String.concat " " (List.map
| LexiconAst.Interpretation (_, dsc, (symbol, _), _) as stm ->
let status = add_lexicon_content [stm] status in
let diff =
- [DisambiguateTypes.Symbol (symbol, 0),
- DisambiguateChoices.lookup_symbol_by_dsc symbol dsc]
+ try
+ [DisambiguateTypes.Symbol (symbol, 0),
+ DisambiguateChoices.lookup_symbol_by_dsc symbol dsc]
+ with
+ DisambiguateChoices.Choice_not_found msg ->
+ prerr_endline (Lazy.force msg);
+ assert false
in
let status = set_proof_aliases mode status diff in
status
- | LexiconAst.Notation _ as stm -> add_lexicon_content [stm] status
+ | LexiconAst.Notation _ as stm ->
+ add_lexicon_content [stm] status
let eval_command = eval_command ?mode:None
None, "Already defined: " ^ UriManager.string_of_uri s
| CoercDb.EqCarrNotImplemented msg ->
None, ("EqCarrNotImplemented: " ^ Lazy.force msg)
+ | DisambiguateChoices.Choice_not_found msg ->
+ None, ("Disambiguation choice not found: " ^ Lazy.force msg)
| MatitaEngine.EnrichedWithLexiconStatus (exn,_) ->
None, "EnrichedWithLexiconStatus "^snd(to_string exn)
| GrafiteDisambiguator.DisambiguationError (offset,errorll) ->
let _,parsed_text_length = MatitaGtkMisc.utf8_parsed_text s loc in
(* CSC: why +1 in the following lines ???? *)
let parsed_text_length = parsed_text_length + 1 in
-prerr_endline ("## " ^ string_of_int parsed_text_length);
let remain_len = String.length s - parsed_text_length in
let next = String.sub s parsed_text_length remain_len in
is_there_only_comments lexicon_status next