aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2017-05-19 15:25:58 +0200
committerPierre-Marie Pédrot2017-05-19 15:59:11 +0200
commit0bfa6d3cda461f4d09ec0bfa9781042199b1f43b (patch)
treecd6fd40caadd97a4e82b2c01945ef3487988cf5f
parent6a4d15c6ce3994509085ef575cc2f242925af15a (diff)
Adding new tactic notation scopes.
-rw-r--r--tac2core.ml43
1 files changed, 43 insertions, 0 deletions
diff --git a/tac2core.ml b/tac2core.ml
index 94758eb217..c82893efc2 100644
--- a/tac2core.ml
+++ b/tac2core.ml
@@ -577,6 +577,27 @@ let () = add_scope "list0" begin function
| _ -> scope_fail ()
end
+let () = add_scope "list1" begin function
+| [tok] ->
+ let Tac2entries.ScopeRule (scope, act) = Tac2entries.parse_scope tok in
+ let scope = Extend.Alist1 scope in
+ let act l =
+ let l = List.map act l in
+ CTacLst (Loc.ghost, l)
+ in
+ Tac2entries.ScopeRule (scope, act)
+| [tok; SexprStr (_, str)] ->
+ let Tac2entries.ScopeRule (scope, act) = Tac2entries.parse_scope tok in
+ let sep = Extend.Atoken (CLexer.terminal str) in
+ let scope = Extend.Alist1sep (scope, sep) in
+ let act l =
+ let l = List.map act l in
+ CTacLst (Loc.ghost, l)
+ in
+ Tac2entries.ScopeRule (scope, act)
+| _ -> scope_fail ()
+end
+
let () = add_scope "opt" begin function
| [tok] ->
let Tac2entries.ScopeRule (scope, act) = Tac2entries.parse_scope tok in
@@ -599,5 +620,27 @@ let () = add_scope "self" begin function
| _ -> scope_fail ()
end
+let () = add_scope "next" begin function
+| [] ->
+ let scope = Extend.Anext in
+ let act tac = rthunk tac in
+ Tac2entries.ScopeRule (scope, act)
+| _ -> scope_fail ()
+end
+
+let () = add_scope "tactic" begin function
+| [] ->
+ (** Default to level 5 parsing *)
+ let scope = Extend.Aentryl (Tac2entries.Pltac.tac2expr, 5) in
+ let act tac = rthunk tac in
+ Tac2entries.ScopeRule (scope, act)
+| [SexprInt (loc, n)] ->
+ let () = if n < 0 || n > 5 then scope_fail () in
+ let scope = Extend.Aentryl (Tac2entries.Pltac.tac2expr, n) in
+ let act tac = rthunk tac in
+ Tac2entries.ScopeRule (scope, act)
+| _ -> scope_fail ()
+end
+
let () = add_generic_scope "ident" Pcoq.Prim.ident Stdarg.wit_ident
let () = add_generic_scope "constr" Pcoq.Constr.constr Stdarg.wit_constr