aboutsummaryrefslogtreecommitdiff
path: root/interp
diff options
context:
space:
mode:
Diffstat (limited to 'interp')
-rw-r--r--interp/notation.ml10
-rw-r--r--interp/notation.mli5
2 files changed, 15 insertions, 0 deletions
diff --git a/interp/notation.ml b/interp/notation.ml
index f74e1d43b7..300f6b1dd0 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -331,6 +331,16 @@ let mkString = function
let delay dir int ?loc x = (dir, (fun () -> int ?loc x))
+type rawnum = Constrexpr.raw_natural_number * Constrexpr.sign
+
+let declare_rawnumeral_interpreter sc dir interp (patl,uninterp,inpat) =
+ declare_prim_token_interpreter sc
+ (fun cont ?loc -> function Numeral (n,s) -> delay dir interp ?loc (n,s)
+ | p -> cont ?loc p)
+ (patl, (fun r -> match uninterp r with
+ | None -> None
+ | Some (n,s) -> Some (Numeral (n,s))), inpat)
+
let declare_numeral_interpreter sc dir interp (patl,uninterp,inpat) =
let interp' ?loc (n,s) = interp ?loc (ofNumeral n s) in
declare_prim_token_interpreter sc
diff --git a/interp/notation.mli b/interp/notation.mli
index d271a88fe7..c739ec12fd 100644
--- a/interp/notation.mli
+++ b/interp/notation.mli
@@ -74,6 +74,11 @@ type 'a prim_token_interpreter =
type 'a prim_token_uninterpreter =
glob_constr list * (glob_constr -> 'a option) * cases_pattern_status
+type rawnum = Constrexpr.raw_natural_number * Constrexpr.sign
+
+val declare_rawnumeral_interpreter : scope_name -> required_module ->
+ rawnum prim_token_interpreter -> rawnum prim_token_uninterpreter -> unit
+
val declare_numeral_interpreter : scope_name -> required_module ->
bigint prim_token_interpreter -> bigint prim_token_uninterpreter -> unit