diff options
author | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2017-08-22 01:19:13 +0200 |
---|---|---|
committer | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2018-02-20 10:03:07 +0100 |
commit | 87a8d6c24fa5d014380340fc09647bcd53b9fb5e (patch) | |
tree | 95d647831a41739a4ae23855aa326cfeb1a15116 /vernac | |
parent | 77ef9a400cd570e0857a45c015bca0308e2a0eff (diff) |
Being more flexible on format Adding a warning to be more informative
Diffstat (limited to 'vernac')
-rw-r--r-- | vernac/metasyntax.ml | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vernac/metasyntax.ml b/vernac/metasyntax.ml index e142f2ab8..1b9cfc07e 100644 --- a/vernac/metasyntax.ml +++ b/vernac/metasyntax.ml @@ -504,6 +504,12 @@ let make_hunks etyps symbols from = let error_format ?loc () = user_err ?loc Pp.(str "The format does not match the notation.") +let warn_format_break = + CWarnings.create ~name:"notation-both-format-and-spaces" ~category:"parsing" + (fun () -> + strbrk "Discarding format implicitly indicated by multiple spaces in notation because an explicit format modifier is given.") + + let rec split_format_at_ldots hd = function | (loc,UnpTerminal s) :: fmt when String.equal s (Id.to_string ldots_var) -> loc, List.rev hd, fmt | u :: fmt -> @@ -575,6 +581,7 @@ let hunks_of_format (from,(vars,typs)) symfmt = | _ -> assert false in symbs, hunk :: l | symbs, [] -> symbs, [] + | Break _ :: symbs, fmt -> warn_format_break (); aux (symbs,fmt) | _, fmt -> error_format ?loc:(fst (List.hd fmt)) () in match aux symfmt with |