diff options
| author | Ralf Jung | 2017-02-14 12:36:15 +0100 |
|---|---|---|
| committer | Ralf Jung | 2017-02-16 16:47:12 +0100 |
| commit | 8ce49dd1b436a17c4ee29c2893133829daac75f0 (patch) | |
| tree | c5b53f5bf86ee07e53d43eec53099ba92ae19503 | |
| parent | 55cb913f029308e97bd262fc18d4338f404e7561 (diff) | |
reject notations that are both 'only printing' and 'only parsing'
| -rw-r--r-- | test-suite/success/Notations.v | 3 | ||||
| -rw-r--r-- | toplevel/metasyntax.ml | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/test-suite/success/Notations.v b/test-suite/success/Notations.v index 32baeaa570..52acad7460 100644 --- a/test-suite/success/Notations.v +++ b/test-suite/success/Notations.v @@ -132,3 +132,6 @@ Qed. (* Check that we can have notations without any symbol iff they are "only printing". *) Fail Notation "" := (@nil). Notation "" := (@nil) (only printing). + +(* Check that a notation cannot be neither parsing nor printing. *) +Fail Notation "'foobarkeyword'" := (@nil) (only parsing, only printing). diff --git a/toplevel/metasyntax.ml b/toplevel/metasyntax.ml index ccb9c99d78..e90d638d03 100644 --- a/toplevel/metasyntax.ml +++ b/toplevel/metasyntax.ml @@ -984,6 +984,7 @@ let remove_curly_brackets l = let compute_syntax_data df modifiers = let (assoc,n,etyps,onlyparse,onlyprint,compat,fmt,extra) = interp_modifiers modifiers in + if onlyprint && onlyparse then error "A notation cannot be both 'only printing' and 'only parsing'."; let assoc = match assoc with None -> (* default *) Some NonA | a -> a in let toks = split_notation_string df in let (recvars,mainvars,symbols) = analyze_notation_tokens toks in |
