repo.or.cz
/
qmc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
removed useless file
[qmc.git]
/
compute.lua
blob
9ef13647cd9e77505350cbf15c0153bb36b3ec83
1
#!/
usr
/
bin
/
lua
2
3
local
fn
= ...
4
local
f
=
assert
(
io
.
open
(
fn
))
5
6
local
l
=
f
:
read
()
7
local
patt
=
'^(#?)(%S+)'
..(
'%s*(%S*)'
):
rep
(
2
)
8
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
18
19
while
l
do
20
transform
(
l
,
l
:
match
(
patt
))
21
l
=
f
:
read
()
22
end
23
24
f
:
close
()
25