about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--dump.lua (renamed from pp.lua)13
-rw-r--r--read.lua2
-rw-r--r--repl.lua2
4 files changed, 8 insertions, 11 deletions
diff --git a/Makefile b/Makefile index 51b3fc2..42349fb 100644 --- a/Makefile +++ b/Makefile
@@ -1,5 +1,5 @@
1LUA ?= rlwrap luajit \ 1LUA ?= rlwrap luajit \
2 -e 'pp = require "pp"' \ 2 -e 'pp = require("dump").pp' \
3 -e 'eval = require "eval"' \ 3 -e 'eval = require "eval"' \
4 -e 'read = require "read"' \ 4 -e 'read = require "read"' \
5 -e 'type = require "type"' \ 5 -e 'type = require "type"' \
diff --git a/pp.lua b/dump.lua index 4d9d9af..dc32096 100644 --- a/pp.lua +++ b/dump.lua
@@ -1,10 +1,9 @@
1--- lam.pp 1--- lam.pp
2 2
3local pp = {} 3local m = {}
4local type = require "type" 4local type = require "type"
5local unpack = table.unpack or unpack
6 5
7function pp.dump (x, lvl) 6function m.dump (x, lvl)
8 lvl = lvl or 0 7 lvl = lvl or 0
9 local space = string.rep(" ", lvl) 8 local space = string.rep(" ", lvl)
10 local output = "" 9 local output = ""
@@ -16,7 +15,7 @@ function pp.dump (x, lvl)
16 if v == x then 15 if v == x then
17 v = "self" 16 v = "self"
18 else 17 else
19 v = pp.dump(v, lvl+2) 18 v = m.dump(v, lvl+2)
20 end 19 end
21 subo = subo .. string.format("\n%s[%s] = %s,", 20 subo = subo .. string.format("\n%s[%s] = %s,",
22 (space.." "), k, v) 21 (space.." "), k, v)
@@ -29,9 +28,9 @@ function pp.dump (x, lvl)
29 return output 28 return output
30end 29end
31 30
32function pp.pp (x) 31function m.pp (x)
33 print(pp.dump(x)) 32 print(m.dump(x))
34end 33end
35 34
36--- 35---
37return pp 36return m
diff --git a/read.lua b/read.lua index f8d6b09..8a154a1 100644 --- a/read.lua +++ b/read.lua
@@ -5,8 +5,6 @@ local t = require "type"
5local utf8 = require "utf8" 5local utf8 = require "utf8"
6local pop = require("util").pop 6local pop = require("util").pop
7 7
8local pp = require("pp").pp
9
10-- TODO: 8-- TODO:
11-- - string reading 9-- - string reading
12-- - # syntax 10-- - # syntax
diff --git a/repl.lua b/repl.lua index 93e430c..a3fdf95 100644 --- a/repl.lua +++ b/repl.lua
@@ -3,7 +3,7 @@
3local m = {} 3local m = {}
4local read = require("read") 4local read = require("read")
5local eval = require("eval") 5local eval = require("eval")
6local pp = require("pp").pp 6local pp = require("dump").pp
7 7
8local function schemeprint (x) 8local function schemeprint (x)
9 -- if x == nil then return end 9 -- if x == nil then return end