diff options
Diffstat (limited to 'stream.sml')
-rw-r--r-- | stream.sml | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -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 |