diff options
Diffstat (limited to 'load.lua')
-rw-r--r-- | load.lua | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/load.lua b/load.lua index 7f14207..db2651f 100644 --- a/load.lua +++ b/load.lua | |||
@@ -15,9 +15,21 @@ local function schemeprint (x) | |||
15 | end | 15 | end |
16 | end | 16 | end |
17 | 17 | ||
18 | local function handle_error (e) | 18 | function core.environment.read (r) |
19 | local start = e:find(": ") | 19 | type.assert_arity(r,1,1) |
20 | return e:sub(start + 2) | 20 | error("unimplemented") |
21 | end | ||
22 | |||
23 | function core.environment.eval (r) | ||
24 | type.assert_arity(r,1,2) | ||
25 | local form = r[1] | ||
26 | local env = r[2][1] or core.environment | ||
27 | return eval.eval(form, env) | ||
28 | end | ||
29 | |||
30 | function core.environment.load (r) | ||
31 | type.assert_arity(r,1,1) | ||
32 | return m.load(tostring(r[1])) | ||
21 | end | 33 | end |
22 | 34 | ||
23 | function m.load (filename, interactive) | 35 | function m.load (filename, interactive) |
@@ -29,6 +41,12 @@ function m.load (filename, interactive) | |||
29 | else | 41 | else |
30 | io.output():setvbuf("no") | 42 | io.output():setvbuf("no") |
31 | end | 43 | end |
44 | |||
45 | local function handle_error (e) | ||
46 | local start = e:find(": ") | ||
47 | return e:sub(start + 2) | ||
48 | end | ||
49 | |||
32 | repeat | 50 | repeat |
33 | if interactive then | 51 | if interactive then |
34 | io.stderr:write(interactive.prompt or "") | 52 | io.stderr:write(interactive.prompt or "") |