diff options
author | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2017-08-15 18:32:02 +0200 |
---|---|---|
committer | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2018-02-20 10:03:05 +0100 |
commit | 398358618bb3eabfe822b79c669703c1c33b67e6 (patch) | |
tree | 967c18294374fe73a51d582cd120ab70eb856936 /parsing | |
parent | e21f70cc2b284a3cf489b16e0251492fb864cf1e (diff) |
Adding patterns in the category of binders for notations.
For instance, the following is now possible:
Check {(x,y)|x+y=0}.
Some questions remains. Maybe, by consistency, the notation should be
"{'(x,y)|x+y=0}"...
Diffstat (limited to 'parsing')
-rw-r--r-- | parsing/g_constr.ml4 | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/parsing/g_constr.ml4 b/parsing/g_constr.ml4 index db68a75e0..4c55f3ec6 100644 --- a/parsing/g_constr.ml4 +++ b/parsing/g_constr.ml4 @@ -387,17 +387,7 @@ GEXTEND Gram | "10" LEFTA [ p = pattern; "as"; id = ident -> CAst.make ~loc:!@loc @@ CPatAlias (p, id) - | p = pattern; lp = LIST1 NEXT -> - (let open CAst in match p with - | { v = CPatAtom (Some r) } -> CAst.make ~loc:!@loc @@ CPatCstr (r, None, lp) - | { v = CPatCstr (r, None, l2); loc } -> - CErrors.user_err ?loc ~hdr:"compound_pattern" - (Pp.str "Nested applications not supported.") - | { v = CPatCstr (r, l1, l2) } -> CAst.make ~loc:!@loc @@ CPatCstr (r, l1 , l2@lp) - | { v = CPatNotation (n, s, l) } -> CAst.make ~loc:!@loc @@ CPatNotation (n , s, l@lp) - | _ -> CErrors.user_err - ?loc:(cases_pattern_expr_loc p) ~hdr:"compound_pattern" - (Pp.str "Such pattern cannot have arguments.")) + | p = pattern; lp = LIST1 NEXT -> mkAppPattern ~loc:!@loc p lp | "@"; r = Prim.reference; lp = LIST0 NEXT -> CAst.make ~loc:!@loc @@ CPatCstr (r, Some lp, []) ] | "1" LEFTA |