summaryrefslogtreecommitdiff
path: root/stream.sml
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-03-27 14:46:47 +0100
committerVladimir Azarov <avm@intermediate-node.net>2025-03-27 14:46:47 +0100
commit11e14dd4b93154964c87fc97cfcee62c52edf97a (patch)
tree6c46e8ecb85cb4266e5a3f1b6029428ac2ca2aed /stream.sml
parent90854ccf3514dc67a30556500e1716dd1933954c (diff)
Number constant parser
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