1234567891011121314151617181920212223242526272829303132333435363738394041424344(************************************************************************)(* * 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) *)(************************************************************************)openPpopenCErrorsopenUtilopenNotation(* Register the grammar of notation for parsing and printing
(also register the parsing rule if not onlyprinting) *)letnotation_grammar_map=Summary.ref~stage:Summary.Stage.Synterp~name:"notation_grammar_map"NotationMap.emptyletdeclare_notation_grammarntnrule=trylet_=NotationMap.findntn!notation_grammar_mapinanomaly(str"Notation "++pr_notationntn++str" is already assigned a grammar.")withNot_found->notation_grammar_map:=NotationMap.addntnrule!notation_grammar_mapletgrammar_of_notationntn=NotationMap.findntn!notation_grammar_mapletnotation_non_terminals_map=Summary.ref~stage:Summary.Stage.Synterp~name:"notation_non_terminals_map"NotationMap.emptyletdeclare_notation_non_terminalsntnentries=trylet_=NotationMap.findntn!notation_grammar_mapinanomaly(str"Notation "++pr_notationntn++str" is already assigned a grammar.")withNot_found->notation_non_terminals_map:=NotationMap.addntnentries!notation_non_terminals_mapletnon_terminals_of_notationntn=NotationMap.findntn!notation_non_terminals_mapletget_defined_notations()=NotationSet.elements@@NotationMap.domain!notation_grammar_map