12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879(************************************************************************)(* * The Coq Proof Assistant / The Coq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)openPcoqtypeproof_mode=string(* Tactic parsing modes *)letregister_proof_mode,find_proof_mode,lookup_proof_mode=letproof_mode:(string,Vernacexpr.vernac_exprEntry.t)Hashtbl.t=Hashtbl.create19inletregister_proof_modeenamee=Hashtbl.addproof_modeenamee;enameinletfind_proof_modeename=tryHashtbl.findproof_modeenamewithNot_found->CErrors.anomalyPp.(str"proof mode not found: "++strename)inletlookup_proof_modename=ifHashtbl.memproof_modenamethenSomenameelseNoneinregister_proof_mode,find_proof_mode,lookup_proof_modeletproof_mode_to_stringname=nameletcommand_entry_ref=refNonemoduleVernac_=struct(* The different kinds of vernacular commands *)letgallina=Entry.create"gallina"letgallina_ext=Entry.create"gallina_ext"letcommand=Entry.create"command"letsyntax=Entry.create"syntax_command"letvernac_control=Entry.create"vernac_control"letinductive_or_record_definition=Entry.create"inductive_or_record_definition"letfix_definition=Entry.create"fix_definition"letred_expr=Entry.create"red_expr"lethint_info=Entry.create"hint_info"(* Main vernac entry *)letmain_entry=Entry.create"vernac"letnoedit_mode=Entry.create"noedit_command"let()=letact_vernacvloc=Somevinletact_eoi_loc=Noneinletrule=[Pcoq.(Production.make(Rule.nextRule.stop(Symbol.tokenTok.PEOI))act_eoi);Pcoq.(Production.make(Rule.nextRule.stop(Symbol.ntermvernac_control))act_vernac);]inPcoq.(grammar_extendmain_entry(Fresh(Gramlib.Gramext.First,[None,None,rule])))letselect_tactic_entryspec=matchspecwith|None->noedit_mode|Someename->find_proof_modeenameletcommand_entry=Pcoq.Entry.(of_parser"command_entry"{parser_fun=(funstrm->Pcoq.Entry.parse_token_stream(select_tactic_entry!command_entry_ref)strm)})endmoduleUnsafe=structletset_tactic_entryoname=command_entry_ref:=onameendletmain_entryproof_mode=Unsafe.set_tactic_entryproof_mode;Vernac_.main_entrylet()=register_grammarGenredexpr.wit_red_expr(Vernac_.red_expr);