Source

planck / sstring.ml

open Spotlib.Spot
open Stream_intf

include Stream.Make(struct
  type elem = string
  let show_elem = Printf.sprintf "%S"
  let equal_elem (x : string) y = x = y
  type attr = unit
  let default_attr = ()
  module Pos = Position.None
  let position_of_attr () = ()
end)

let from_string str = Lazy.lazy_from_val (cons_desc str () (null ()))

let from_chan ic =
  let len = 1024 in
  let rec read () = lazy begin
    let buf = String.create len in
    let read_bytes = input ic buf 0 len in
    if read_bytes = 0 then null_desc ()
    else
      let str = String.sub buf 0 read_bytes in
      cons_desc str () (read ())
  end
  in
  read ()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.