summaryrefslogtreecommitdiff
path: root/stream.sml
diff options
context:
space:
mode:
Diffstat (limited to 'stream.sml')
-rw-r--r--stream.sml16
1 files changed, 5 insertions, 11 deletions
diff --git a/stream.sml b/stream.sml
index eb2cea1..1755817 100644
--- a/stream.sml
+++ b/stream.sml
@@ -42,16 +42,6 @@ structure Stream :> STREAM = struct
print $ fname ^ ":" ^ line ^ ":" ^ col ^ ": "
end
- fun readFile fname =
- let
- open TextIO
- val h = openIn fname
- val s = inputAll h
- val () = closeIn h
- in
- s
- end
-
fun getchar (S as (fid, fname, off, contents)) =
if off < String.size contents then
(SOME $ String.sub (contents, off), (fid, fname, off + 1, contents))
@@ -83,7 +73,11 @@ structure Stream :> STREAM = struct
fun streamInit fname =
let
- val contents = readFile fname
+ open TextIO
+
+ val h = openIn fname
+ val contents = inputAll h
+ val () = closeIn h
in
(0, fname, 0, contents)
end