aboutsummaryrefslogtreecommitdiff
path: root/grammar
diff options
context:
space:
mode:
authorMaxime Dénès2017-11-03 10:57:46 +0100
committerMaxime Dénès2017-11-03 10:57:46 +0100
commit87f3278ea3520ed2b2a4b355765392550488c1df (patch)
treeaaef8759f8f2755a4194c5de370ab3fc3325c25d /grammar
parent97e82c1a520382ec34cfedcc55b5190126b05703 (diff)
parentd073a70d84aa6802a03d03a17d2246d607e85db1 (diff)
Merge PR #6047: A generic printer for ltac values
Diffstat (limited to 'grammar')
-rw-r--r--grammar/argextend.mlp7
-rw-r--r--grammar/q_util.mlp8
2 files changed, 9 insertions, 6 deletions
diff --git a/grammar/argextend.mlp b/grammar/argextend.mlp
index 12b7b171b7..9742a002d7 100644
--- a/grammar/argextend.mlp
+++ b/grammar/argextend.mlp
@@ -186,12 +186,7 @@ let declare_vernac_argument loc s pr cl =
value ($lid:"wit_"^s$ : Genarg.genarg_type 'a unit unit) =
Genarg.create_arg $se$ >>;
make_extend loc s cl wit;
- <:str_item< do {
- Pptactic.declare_extra_genarg_pprule $wit$
- $pr_rules$
- (fun _ _ _ _ -> CErrors.anomaly (Pp.str "vernac argument needs not globwit printer."))
- (fun _ _ _ _ -> CErrors.anomaly (Pp.str "vernac argument needs not wit printer.")) }
- >> ]
+ <:str_item< Pptactic.declare_extra_vernac_genarg_pprule $wit$ $pr_rules$ >> ]
open Pcaml
diff --git a/grammar/q_util.mlp b/grammar/q_util.mlp
index 536ee7ca56..c2d767396a 100644
--- a/grammar/q_util.mlp
+++ b/grammar/q_util.mlp
@@ -94,10 +94,14 @@ let coincide s pat off =
done;
!break
+let check_separator sep =
+ if sep <> "" then failwith "Separator is only for arguments with suffix _list_sep."
+
let rec parse_user_entry s sep =
let l = String.length s in
if l > 8 && coincide s "ne_" 0 && coincide s "_list" (l - 5) then
let entry = parse_user_entry (String.sub s 3 (l-8)) "" in
+ check_separator sep;
Ulist1 entry
else if l > 12 && coincide s "ne_" 0 &&
coincide s "_list_sep" (l-9) then
@@ -105,16 +109,20 @@ let rec parse_user_entry s sep =
Ulist1sep (entry, sep)
else if l > 5 && coincide s "_list" (l-5) then
let entry = parse_user_entry (String.sub s 0 (l-5)) "" in
+ check_separator sep;
Ulist0 entry
else if l > 9 && coincide s "_list_sep" (l-9) then
let entry = parse_user_entry (String.sub s 0 (l-9)) "" in
Ulist0sep (entry, sep)
else if l > 4 && coincide s "_opt" (l-4) then
let entry = parse_user_entry (String.sub s 0 (l-4)) "" in
+ check_separator sep;
Uopt entry
else if l = 7 && coincide s "tactic" 0 && '5' >= s.[6] && s.[6] >= '0' then
let n = Char.code s.[6] - 48 in
+ check_separator sep;
Uentryl ("tactic", n)
else
let s = match s with "hyp" -> "var" | _ -> s in
+ check_separator sep;
Uentry s