diff options
author | Vladimir Azarov <avm@intermediate-node.net> | 2025-03-27 14:46:47 +0100 |
---|---|---|
committer | Vladimir Azarov <avm@intermediate-node.net> | 2025-03-27 14:46:47 +0100 |
commit | 11e14dd4b93154964c87fc97cfcee62c52edf97a (patch) | |
tree | 6c46e8ecb85cb4266e5a3f1b6029428ac2ca2aed /stream.sml | |
parent | 90854ccf3514dc67a30556500e1716dd1933954c (diff) |
Number constant parser
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 |