From 11e14dd4b93154964c87fc97cfcee62c52edf97a Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Thu, 27 Mar 2025 14:46:47 +0100 Subject: Number constant parser --- stream.sml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'stream.sml') 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 -- cgit v1.2.3