diff options
author | Marius <mariausol@gmail.com> | 2012-06-20 22:40:19 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-06-20 22:40:19 +0300 |
commit | f4a7ea86b474561c07f0eb8cca0dfcc6a6bb5a8a (patch) | |
tree | c592db392d10d415ad3636ec1234d3fec3ed712d /scripts | |
parent | 74ee3251df8c455d72f79887068b40c5b75a01c9 (diff) | |
download | context-f4a7ea86b474561c07f0eb8cca0dfcc6a6bb5a8a.tar.gz |
beta 2012.06.20 20:43
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-scite.lua | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/scripts/context/lua/mtx-scite.lua b/scripts/context/lua/mtx-scite.lua index 116555e79..3369c5f3b 100644 --- a/scripts/context/lua/mtx-scite.lua +++ b/scripts/context/lua/mtx-scite.lua @@ -199,14 +199,31 @@ function scripts.scite.words() if lfs.isfile(txtname) then report("loading %s",txtname) local olddata = io.loaddata(txtname) or "" + local words = splitwords(olddata) + local min, max, n = 100, 1, 0 + for k, v in next, words do + local l = #k + if l < min then + min = l + end + if l > max then + max = l + end + n = n + 1 + end + if min > max then + min = max + end local newdata = { - words = splitwords(olddata), - -- words = olddata, + words = words, source = oldname, + min = min, + max = max, + n = n, } - report("saving %s",luaname) + report("saving %q, %s words, %s shortest, %s longest",luaname,n,min,max) io.savedata(luaname,table.serialize(newdata,true)) - report("compiling %s",lucname) + report("compiling %q",lucname) os.execute(format("luac -s -o %s %s",lucname,luaname)) else report("no data file %s",txtname) |