- let (context, metasenv) = ([], []) in
- let id_to_uris_raw =
- try req#param "aliases"
- with Http_types.Param_not_found _ -> ""
- in
- let parse_interpretation_choices choices =
- List.map int_of_string (Pcre.split ~pat:" " choices) in
- let parse_choices choices_raw =
- let choices = Pcre.split ~pat:";" choices_raw in
- List.fold_left
- (fun f x ->
- match Pcre.split ~pat:"\\s" x with
- | ""::id::tail
- | id::tail when id<>"" ->
- (fun id' ->
- if id = id' then
- Some (List.map (fun u -> Netencoding.Url.decode u) tail)
- else
- f id')
- | _ -> failwith "Can't parse choices")
- (fun _ -> None)
- choices
- in
- let id_to_uris = CicTextualParser2.EnvironmentP3.of_string id_to_uris_raw in
- let id_to_choices =
- try
- parse_choices (req#param "choices")
- with Http_types.Param_not_found _ -> (fun _ -> None)
- in
- let interpretation_choices =
- try
- let choices_raw = req#param "interpretation_choices" in
- if choices_raw = "" then None
- else Some (parse_interpretation_choices choices_raw)
- with Http_types.Param_not_found _ -> None
- in
- let module Chat: DisambiguateTypes.Callbacks =
- struct
- let interactive_user_uri_choice ~selection_mode ?ok
- ?enable_button_for_non_vars ~(title: string) ~(msg: string)
- ~(id: string) (choices: string list)
- =
- match id_to_choices id with
- | Some choices -> choices
- | None -> List.filter nonvar choices
+ try
+ if req#path = "/elim" &&
+ not (Pcre.pmatch ~rex:identifier_RE term_str ||
+ Pcre.pmatch ~rex:qualified_mutind_RE term_str) then
+ raise Not_a_MutInd;
+ let (context, metasenv) = ([], []) in
+ let id_to_uris_raw =
+ try req#param "aliases"
+ with Http_types.Param_not_found _ -> ""
+ in
+ let parse_interpretation_choices choices =
+ List.map int_of_string (Pcre.split ~pat:" " choices) in
+ let parse_choices choices_raw =
+ let choices = Pcre.split ~pat:";" choices_raw in
+ List.fold_left
+ (fun f x ->
+ match Pcre.split ~pat:"\\s" x with
+ | ""::id::tail
+ | id::tail when id<>"" ->
+ (fun id' ->
+ if id = id' then
+ Some (List.map
+ (fun u -> UriManager.uri_of_string
+ (Netencoding.Url.decode u))
+ tail)
+ else
+ f id')
+ | _ -> failwith "Can't parse choices")
+ (fun _ -> None)
+ choices
+ in
+ let id_to_uris = CicTextualParser2.EnvironmentP3.of_string id_to_uris_raw in
+ let id_to_choices =
+ try
+ parse_choices (req#param "choices")
+ with Http_types.Param_not_found _ -> (fun _ -> None)
+ in
+ let interpretation_choices =
+ try
+ let choices_raw = req#param "interpretation_choices" in
+ if choices_raw = "" then None
+ else Some (parse_interpretation_choices choices_raw)
+ with Http_types.Param_not_found _ -> None
+ in
+ let module Chat: DisambiguateTypes.Callbacks =
+ struct
+ let interactive_user_uri_choice ~selection_mode ?ok
+ ?enable_button_for_non_vars ~(title: string) ~(msg: string)
+ ~(id: string) (choices: UriManager.uri list)
+ =
+ match id_to_choices id with
+ | Some choices -> choices
+ | None -> List.filter nonvar choices