1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798(************************************************************************)(* * 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) *)(************************************************************************)openLibobjecttypetac_option_locality=|Default|Global|Local|Export|GlobalAndExportlettac_option_locality=letopenAttributesinletopenAttributes.Notationsinletonex=attribute_of_list[x,single_key_parser~name:"Locality"~key:x()]inone"local"++one"global"++one"export">>=fun((local,global),export)->matchlocal,global,exportwith|None,None,None->returnDefault|Some(),Some(),_->CErrors.user_errPp.(str"Cannot combine local and global.")|Some(),_,Some()->CErrors.user_errPp.(str"Cannot combine local and export.")|Some(),None,None->returnLocal|None,Some(),None->returnGlobal|None,None,Some()->returnExport|None,Some(),Some()->returnGlobalAndExportletwarn_default_locality=CWarnings.create~name:"deprecated-tacopt-without-locality"~category:Deprecation.Version.v8_17Pp.(fun()->strbrk"The default and global localities for this command outside \
sections are currently equivalent to the combination of the \
standard meaning of \"global\" (as described in the reference \
manual), \"export\" and re-exporting for every surrounding \
module. It will change to just \"global\" (with the meaning \
used by the \"Set\" command) in a future release."++fnl()++strbrk"To preserve the current meaning in a forward compatible way, \
use the attribute \"#[global,export]\" and repeat the command \
with just \"#[export]\" in any surrounding modules. If you \
are fine with the change of semantics, disable this warning.")letdeclare_tactic_option?(default=CAst.make(Tacexpr.TacId[]))name=letdefault_tactic:Tacexpr.glob_tactic_exprref=Summary.refdefault~name:(name^"-default-tactic")inletset_default_tactict=default_tactic:=tinletcache(_,tac)=set_default_tactictacinletload_(local,tac)=matchlocalwith|Default|Global|GlobalAndExport->set_default_tactictac|Export->()|Local->assertfalse(* not allowed by classify *)inletimporti(local,tac)=matchlocalwith|GlobalAndExport|Export->ifInt.equali1thenset_default_tactictac|Default|Global->set_default_tactictac|Local->assertfalse(* not allowed by classify *)inletclassify(local,_)=matchlocalwith|Local->Dispose|Default|Global|Export|GlobalAndExport->Substituteinletsubst(s,(local,tac))=(local,Tacsubst.subst_tacticstac)inletinput:tac_option_locality*Tacexpr.glob_tactic_expr->obj=declare_object{(default_objectname)withcache_function=cache;load_function=load;open_function=simple_openimport;classify_function=classify;subst_function=subst}inletput?loclocaltac=let()=matchlocalwith|Default->ifnot(Lib.sections_are_opened())thenwarn_default_locality?loc()|Local->()|Export|Global|GlobalAndExport->ifLib.sections_are_opened()thenCErrors.user_err?locPp.(str"This locality is not supported inside sections by this command.")inLib.add_leaf(input(local,tac))inletget()=Tacinterp.eval_tactic!default_tacticinletprint()=Pptactic.pr_glob_tactic(Global.env())!default_tacticinput,get,print