From 0acaa906367c02c57a6d70dd5d19eaea884b7568 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Thu, 10 May 2018 15:04:13 +0200 Subject: Fixes #7462, part 2 (only-printing not make believe parsing rule is declared). --- interp/notation.ml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'interp/notation.ml') diff --git a/interp/notation.ml b/interp/notation.ml index 76d0efb72a..20e46bfe3f 100644 --- a/interp/notation.ml +++ b/interp/notation.ml @@ -429,13 +429,15 @@ let rec find_without_delimiters find (ntn_scope,ntn) = function (* Uninterpreted notation levels *) -let declare_notation_level ntn level = +let declare_notation_level ?(onlyprint=false) ntn level = if String.Map.mem ntn !notation_level_map then anomaly (str "Notation " ++ str ntn ++ str " is already assigned a level."); - notation_level_map := String.Map.add ntn level !notation_level_map + notation_level_map := String.Map.add ntn (level,onlyprint) !notation_level_map -let level_of_notation ntn = - String.Map.find ntn !notation_level_map +let level_of_notation ?(onlyprint=false) ntn = + let (level,onlyprint') = String.Map.find ntn !notation_level_map in + if onlyprint' && not onlyprint then raise Not_found; + level (* The mapping between notations and their interpretation *) -- cgit v1.2.3