diff options
| author | Hugo Herbelin | 2018-05-10 15:04:13 +0200 |
|---|---|---|
| committer | Hugo Herbelin | 2018-05-10 15:53:06 +0200 |
| commit | 0acaa906367c02c57a6d70dd5d19eaea884b7568 (patch) | |
| tree | 12cf860589f0d32db04610771752d6022a0c01d9 /interp/notation.ml | |
| parent | dfa99b152114271cf9fac4cab9d8663ac6ec078c (diff) | |
Fixes #7462, part 2 (only-printing not make believe parsing rule is declared).
Diffstat (limited to 'interp/notation.ml')
| -rw-r--r-- | interp/notation.ml | 10 |
1 files changed, 6 insertions, 4 deletions
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 *) |
