aboutsummaryrefslogtreecommitdiff
path: root/lib/lexbuf.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lexbuf.ml')
-rw-r--r--lib/lexbuf.ml14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/lexbuf.ml b/lib/lexbuf.ml
new file mode 100644
index 0000000..2ed9099
--- /dev/null
+++ b/lib/lexbuf.ml
@@ -0,0 +1,14 @@
+type t = Sedlexing.lexbuf
+
+let buffer : t -> Sedlexing.lexbuf = fun t -> t
+let start : t -> unit = fun t -> Sedlexing.start t
+
+let positions : t -> Lexing.position * Lexing.position =
+ fun t -> Sedlexing.lexing_positions t
+
+let content : t -> string = fun t -> Sedlexing.Utf8.lexeme t
+let from_lexbuf : Sedlexing.lexbuf -> t = fun t -> t
+
+let tokenize : (t -> 'a) -> t -> unit -> 'a * Lexing.position * Lexing.position
+ =
+ fun f lexbuf -> Sedlexing.with_tokenizer f lexbuf