aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp
diff options
context:
space:
mode:
authorGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2018-05-10 15:04:13 +0200
committerGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2018-05-10 15:53:06 +0200
commit0acaa906367c02c57a6d70dd5d19eaea884b7568 (patch)
tree12cf860589f0d32db04610771752d6022a0c01d9 /interp
parentdfa99b152114271cf9fac4cab9d8663ac6ec078c (diff)
Fixes #7462, part 2 (only-printing not make believe parsing rule is declared).
Diffstat (limited to 'interp')
-rw-r--r--interp/notation.ml10
-rw-r--r--interp/notation.mli4
2 files changed, 8 insertions, 6 deletions
diff --git a/interp/notation.ml b/interp/notation.ml
index 76d0efb72..20e46bfe3 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 *)
diff --git a/interp/notation.mli b/interp/notation.mli
index eac87414f..ccc67fe49 100644
--- a/interp/notation.mli
+++ b/interp/notation.mli
@@ -137,8 +137,8 @@ val availability_of_notation : scope_name option * notation -> local_scopes ->
(** {6 Declare and test the level of a (possibly uninterpreted) notation } *)
-val declare_notation_level : notation -> level -> unit
-val level_of_notation : notation -> level (** raise [Not_found] if no level *)
+val declare_notation_level : ?onlyprint:bool -> notation -> level -> unit
+val level_of_notation : ?onlyprint:bool -> notation -> level (** raise [Not_found] if no level or not respecting onlyprint *)
(** {6 Miscellaneous} *)