aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/notation.ml
diff options
context:
space:
mode:
authorGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2017-05-31 21:48:26 +0200
committerGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2017-06-14 09:44:21 +0200
commit0b5ef21f936acbb89fa5b272efdcf3cf03de58cc (patch)
treedefb9da9cc6c74b690a409a7c1a8461b342d5239 /interp/notation.ml
parent2bc76bf063da72d1db38c3c0d29c747b0fe23f78 (diff)
Notation.declare_rawnumeral_interpreter
This new function is similar to declare_numeral_interpreter, but works on a lower level : instead of bigint, numbers are represented as string of their decimal digits (plus a boolean sign)
Diffstat (limited to 'interp/notation.ml')
-rw-r--r--interp/notation.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/interp/notation.ml b/interp/notation.ml
index f74e1d43b..300f6b1dd 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