Skip to content

Commit

Permalink
Drop Stream API that was removed in OCaml 4.14.0 ahead of the `5.…
Browse files Browse the repository at this point in the history
…0` release.
  • Loading branch information
toots committed May 19, 2022
1 parent 96cffd2 commit 4345df6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
3.0:
* Dropped `Stream` api which was removed in `4.14.0` ahead of the `5.0`
release.

2.6:
* Adapted to ppxlib `0.26`, thanks to @pitag-ha

Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(lang dune 2.8)
(version 2.6)
(version 3.0)
(name sedlex)
(source (github ocaml-community/sedlex))
(license MIT)
Expand Down
2 changes: 1 addition & 1 deletion sedlex.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "2.6"
version: "3.0"
synopsis: "An OCaml lexer generator for Unicode"
description: """
sedlex is a lexer generator for OCaml. It is similar to ocamllex, but supports
Expand Down
9 changes: 0 additions & 9 deletions src/lib/sedlexing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ let gen_of_channel chan =

let ( >>= ) o f = match o with Some x -> f x | None -> None

(* For legacy purposes. *)
let gen_of_stream stream =
let f () = try Some (Stream.next stream) with Stream.Failure -> None in
f

(* Absolute position from the beginning of the stream *)
type apos = int

Expand Down Expand Up @@ -95,7 +90,6 @@ let fill_buf_from_gen f gen buf pos len =
aux 0

let from_gen s = create (fill_buf_from_gen (fun id -> id) s)
let from_stream s = from_gen @@ gen_of_stream s

let from_int_array a =
let len = Array.length a in
Expand Down Expand Up @@ -224,7 +218,6 @@ let with_tokenizer lexer' lexbuf =

module Latin1 = struct
let from_gen s = create (fill_buf_from_gen Uchar.of_char s)
let from_stream s = from_gen @@ gen_of_stream s

let from_string s =
let len = String.length s in
Expand Down Expand Up @@ -403,7 +396,6 @@ module Utf8 = struct
let from_gen s =
create (fill_buf_from_gen (fun id -> id) (Helper.gen_from_char_gen s))

let from_stream s = from_gen @@ gen_of_stream s
let from_string s = from_int_array (Helper.to_int_array s 0 (String.length s))

let sub_lexeme lexbuf pos len =
Expand Down Expand Up @@ -520,7 +512,6 @@ module Utf16 = struct
end

let from_gen s opt_bo = from_gen (Helper.gen_from_char_gen opt_bo s)
let from_stream s = from_gen @@ gen_of_stream s
let from_channel ic opt_bo = from_gen (gen_of_channel ic) opt_bo

let from_string s opt_bo =
Expand Down
17 changes: 0 additions & 17 deletions src/lib/sedlexing.mli
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ val set_filename : lexbuf -> string -> unit
(** Create a lexbuf from a stream of Unicode code points. *)
val from_gen : Uchar.t Gen.t -> lexbuf

(** Create a lexbuf from a stream of Unicode code points. *)
val from_stream : Uchar.t Stream.t -> lexbuf
[@@ocaml.deprecated "Use [Sedlexing.from_gen] instead."]

(** Create a lexbuf from an array of Unicode code points. *)
val from_int_array : int array -> lexbuf

Expand Down Expand Up @@ -186,11 +182,6 @@ module Latin1 : sig
of Unicode code points in the range [0..255]) *)
val from_gen : char Gen.t -> lexbuf

(** Create a lexbuf from a Latin1 encoded stream (ie a stream
of Unicode code points in the range [0..255]) *)
val from_stream : char Stream.t -> lexbuf
[@@ocaml.deprecated "Use [Sedlexing.Latin1.from_gen] instead."]

(** Create a lexbuf from a Latin1 encoded input channel.
The client is responsible for closing the channel. *)
val from_channel : in_channel -> lexbuf
Expand Down Expand Up @@ -218,10 +209,6 @@ module Utf8 : sig
(** Create a lexbuf from a UTF-8 encoded stream. *)
val from_gen : char Gen.t -> lexbuf

(** Create a lexbuf from a UTF-8 encoded stream. *)
val from_stream : char Stream.t -> lexbuf
[@@ocaml.deprecated "Use [Sedlexing.Utf8.from_gen] instead."]

(** Create a lexbuf from a UTF-8 encoded input channel. *)
val from_channel : in_channel -> lexbuf

Expand All @@ -248,10 +235,6 @@ module Utf16 : sig
Utf16.InvalidCodepoint. *)
val from_gen : char Gen.t -> byte_order option -> lexbuf

(** Works as [Utf16.from_gen] with a [stream]. *)
val from_stream : char Stream.t -> byte_order option -> lexbuf
[@@ocaml.deprecated "Use [Sedlexing.Utf16.from_gen] instead."]

(** Works as [Utf16.from_gen] with an [in_channel]. *)
val from_channel : in_channel -> byte_order option -> lexbuf

Expand Down

0 comments on commit 4345df6

Please sign in to comment.