removed useless file
[qmc.git] / compute.lua
blob9ef13647cd9e77505350cbf15c0153bb36b3ec83
1 #!/usr/bin/lua
3 local fn = ...
4 local f = assert(io.open(fn))
6 local l = f:read()
7 local patt = '^(#?)(%S+)'..('%s*(%S*)'):rep(2)
9 local r = setmetatable({}, {__index=table})
10 local transform = function(l, c, s, e, w)
11 if c=='#' then
12 r:insert(l)
13 else
14 r:insert('* '..e)
15 end
16 return c, s
17 end
19 while l do
20 transform(l, l:match(patt))
21 l = f:read()
22 end
24 f:close()