aboutsummaryrefslogtreecommitdiff
path: root/parsing
diff options
context:
space:
mode:
Diffstat (limited to 'parsing')
-rw-r--r--parsing/lexer.ml43
-rw-r--r--parsing/tok.ml4
-rw-r--r--parsing/tok.mli2
3 files changed, 9 insertions, 0 deletions
diff --git a/parsing/lexer.ml4 b/parsing/lexer.ml4
index 46dd516be8..61ff69ba7f 100644
--- a/parsing/lexer.ml4
+++ b/parsing/lexer.ml4
@@ -94,6 +94,9 @@ module Error = struct
| UnsupportedUnicode x ->
Printf.sprintf "Unsupported Unicode character (0x%x)" x)
+ (* Require to fix the Camlp4 signature *)
+ let print ppf x = Pp.pp_with ppf (Pp.str (to_string x))
+
end
open Error
diff --git a/parsing/tok.ml b/parsing/tok.ml
index 69fcca98d7..52d56c4dd6 100644
--- a/parsing/tok.ml
+++ b/parsing/tok.ml
@@ -45,6 +45,10 @@ let match_keyword kwd = function
| KEYWORD kwd' when kwd = kwd' -> true
| _ -> false
+(* Needed to fix Camlp4 signature.
+ Cannot use Pp because of silly Tox -> Compat -> Pp dependency *)
+let print ppf tok = Format.pp_print_string ppf (to_string tok)
+
(** For camlp5, conversion from/to [Plexing.pattern],
and a match function analoguous to [Plexing.default_match] *)
diff --git a/parsing/tok.mli b/parsing/tok.mli
index d3c178b5a3..7c685a67ce 100644
--- a/parsing/tok.mli
+++ b/parsing/tok.mli
@@ -21,6 +21,8 @@ type t =
val extract_string : t -> string
val to_string : t -> string
+(* Needed to fit Camlp4 signature *)
+val print : Format.formatter -> t -> unit
val match_keyword : string -> t -> bool
(** for camlp5 *)
val of_pattern : string*string -> t