123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100(************************************************************************)(* * 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) *)(************************************************************************)(** Entry keys for constr notations *)typeproduction_position=|BorderProdofConstrexpr.side*Gramlib.Gramext.g_assocoption|InternalProdtypeproduction_level=|NextLevel|NumLevelofint|DefaultLevel(** Interpreted differently at the border or inside a rule *)letproduction_level_eqlev1lev2=matchlev1,lev2with|NextLevel,NextLevel->true|NumLeveln1,NumLeveln2->Int.equaln1n2|DefaultLevel,DefaultLevel->true|(NextLevel|NumLevel_|DefaultLevel),_->false(** User-level types used to tell how to parse or interpret of the non-terminal *)type'aconstr_entry_key_gen=|ETIdent|ETName|ETGlobal|ETBigint|ETBinderofbool(* open list of binders if true, closed list of binders otherwise *)|ETConstrofConstrexpr.notation_entry*Notation_term.notation_binder_kindoption*'a|ETPatternofbool*intoption(* true = strict pattern, i.e. not a single variable *)letconstr_entry_key_eq_genbinder_kind_eqv1v2=matchv1,v2with|ETIdent,ETIdent->true|ETName,ETName->true|ETGlobal,ETGlobal->true|ETBigint,ETBigint->true|ETBinderb1,ETBinderb2->b1==b2|ETConstr(s1,bko1,_lev1),ETConstr(s2,bko2,_lev2)->Notationextern.notation_entry_eqs1s2&&binder_kind_eqbko1bko2|ETPattern(b1,n1),ETPattern(b2,n2)->b1=b2&&Option.equalInt.equaln1n2|(ETIdent|ETName|ETGlobal|ETBigint|ETBinder_|ETConstr_|ETPattern_),_->falseletconstr_entry_key_eq=constr_entry_key_eq_gen(Option.equalNotationextern.notation_binder_kind_eq)letconstr_entry_key_eq_ignore_binder_kind=constr_entry_key_eq_gen(fun__->true)(** Entries level (left-hand side of grammar rules) *)typeconstr_entry_key=(production_level*production_position)constr_entry_key_gen(** Entries used in productions, vernac side (e.g. "x bigint" or "x ident") *)typesimple_constr_prod_entry_key=production_levelconstr_entry_key_gen(** Entries used in productions (in right-hand-side of grammar rules), to parse non-terminals *)typebinder_target=ForBinder|ForTermtypebinder_entry_kind=ETBinderOpen|ETBinderClosedofconstr_prod_entry_keyoption*(bool*string)listandconstr_prod_entry_key=|ETProdIdent(* Parsed as an ident *)|ETProdName(* Parsed as a name (ident or _) *)|ETProdGlobal(* Parsed as a global reference *)|ETProdBigint(* Parsed as an (unbounded) integer *)|ETProdOneBinderofbool(* Parsed as name, or name:type or 'pattern, possibly in closed form *)|ETProdConstrofConstrexpr.notation_entry*(production_level*production_position)(* Parsed as constr or custom when extending a constr or custom entry; parsed as pattern or custom pattern when extending a pattern or custom pattern entry *)|ETProdPatternofint(* Parsed as pattern as a binder (as subpart of a constr) *)|ETProdConstrListofConstrexpr.notation_entry*(production_level*production_position)*(bool*string)list(* Parsed as a non-empty list of constr or custom entry *)|ETProdBinderListofbinder_entry_kind(* Parsed as non-empty list of local binders *)(** {5 AST for user-provided entries} *)type'auser_symbol=|Ulist1of'auser_symbol|Ulist1sepof'auser_symbol*string|Ulist0of'auser_symbol|Ulist0sepof'auser_symbol*string|Uoptof'auser_symbol|Uentryof'a|Uentrylof'a*inttype('a,'b,'c)ty_user_symbol=|TUlist1:('a,'b,'c)ty_user_symbol->('alist,'blist,'clist)ty_user_symbol|TUlist1sep:('a,'b,'c)ty_user_symbol*string->('alist,'blist,'clist)ty_user_symbol|TUlist0:('a,'b,'c)ty_user_symbol->('alist,'blist,'clist)ty_user_symbol|TUlist0sep:('a,'b,'c)ty_user_symbol*string->('alist,'blist,'clist)ty_user_symbol|TUopt:('a,'b,'c)ty_user_symbol->('aoption,'boption,'coption)ty_user_symbol|TUentry:('a,'b,'c)Genarg.ArgT.tag->('a,'b,'c)ty_user_symbol|TUentryl:('a,'b,'c)Genarg.ArgT.tag*int->('a,'b,'c)ty_user_symbol