aboutsummaryrefslogtreecommitdiff
path: root/ocaml/reader.ml
diff options
context:
space:
mode:
authorChouser <chouser@n01se.net>2015-01-28 13:13:44 -0500
committerChouser <chouser@n01se.net>2015-01-30 12:54:43 -0500
commit776cf577064c2676e33987546f10c2be80b26344 (patch)
treeea9739cb9d4ba38dbd605864399677c21b6f6933 /ocaml/reader.ml
parentf64fac7bd1bcdfb0061dc983be4bd578f6d55856 (diff)
downloadmal-776cf577064c2676e33987546f10c2be80b26344.tar.gz
mal-776cf577064c2676e33987546f10c2be80b26344.zip
Ocaml: Finish adding step 6
Diffstat (limited to 'ocaml/reader.ml')
-rw-r--r--ocaml/reader.ml9
1 files changed, 8 insertions, 1 deletions
diff --git a/ocaml/reader.ml b/ocaml/reader.ml
index 0bb4328..36f0b2a 100644
--- a/ocaml/reader.ml
+++ b/ocaml/reader.ml
@@ -1,10 +1,17 @@
module T = Types.Types
(* ^file ^module *)
+let slurp filename =
+ let chan = open_in filename in
+ let b = Buffer.create 27 in
+ Buffer.add_channel b chan (in_channel_length chan) ;
+ close_in chan ;
+ Buffer.contents b
+
let find_re re str =
List.map (function | Str.Delim x -> x | Str.Text x -> "impossible!")
(List.filter (function | Str.Delim x -> true | Str.Text x -> false)
- (Str.full_split re str)) ;;
+ (Str.full_split re str))
let gsub re f str =
String.concat