about summary refs log tree commit diff stats
path: root/load.lua
diff options
context:
space:
mode:
authorCase Duckworth2024-04-13 18:01:12 -0500
committerCase Duckworth2024-04-13 18:01:27 -0500
commit81be7fec584156d80020bcdab896a64d758baa87 (patch)
treed0ef58ddbc23c054fa61a8b51f020856138f0bce /load.lua
parentAdd values and string-append (diff)
downloadlam-81be7fec584156d80020bcdab896a64d758baa87.tar.gz
lam-81be7fec584156d80020bcdab896a64d758baa87.zip
Move port.lua to type.lua
Ports are types
Diffstat (limited to 'load.lua')
-rw-r--r--load.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/load.lua b/load.lua index f798712..7f14207 100644 --- a/load.lua +++ b/load.lua
@@ -3,7 +3,6 @@
3local m = {} 3local m = {}
4local core = require("core") 4local core = require("core")
5local eval = require("eval") 5local eval = require("eval")
6local port = require("port")
7local read = require("read") 6local read = require("read")
8local type = require("type") 7local type = require("type")
9 8
@@ -23,7 +22,7 @@ end
23 22
24function m.load (filename, interactive) 23function m.load (filename, interactive)
25 -- interactive = { out = file/handle, prompt = string, } 24 -- interactive = { out = file/handle, prompt = string, }
26 local inport = port.input_port(filename) 25 local inport = type.input_port(filename)
27 if interactive then 26 if interactive then
28 io.output(interactive.out) 27 io.output(interactive.out)
29 io.output():setvbuf("line") 28 io.output():setvbuf("line")
@@ -39,7 +38,7 @@ function m.load (filename, interactive)
39 local read_ok, form = xpcall( 38 local read_ok, form = xpcall(
40 function () return read.read(inport) end, 39 function () return read.read(inport) end,
41 handle_error) 40 handle_error)
42 if form == port.eof then break end 41 if form == type.eof then break end
43 if not read_ok then 42 if not read_ok then
44 io.stderr:write("error (read): ", form, "\n") 43 io.stderr:write("error (read): ", form, "\n")
45 -- when interactive, errors should not be fatal, but 44 -- when interactive, errors should not be fatal, but
@@ -61,7 +60,7 @@ function m.load (filename, interactive)
61 if interactive then schemeprint(value) end 60 if interactive then schemeprint(value) end
62 end 61 end
63 end 62 end
64 until value == port.eof -- loop 63 until value == type.eof -- loop
65end 64end
66 65
67-------- 66--------