[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripts for StrongED



Dear Richard

Thanks for the Scripts page. I am slightly embarrassed by my Lua
example scripts, some of which were really just experiments for
rather particular questions, and probably not worth inflicting on
the public. Some are rather out of date.

Take "dedupe" for example. A much better version would
be

#! lua
local  seen = { }
for line in io.lines (arg[1]) do
    if not seen[line] then
      print (line) -- lines already seen not printed
      seen[line] = true
    end -- if
end -- for

The "ab" script is only there to show that lpeg can recognize
patterns that are not regular. The pumping lemma states that the
class of strings containing equal numbers of "a"s and "b"s
cannot be recognized by a finite state machine.

I have forgotten what Blup is supposed to do.

"bracket" is to show lpeg patterns that match well-bracketed
expressions.

"number" is rather out of date.  "number2" skips blank lines.
"StripDocx" is the same as "striptag".

The whole point of scripts is that they should be short and should
tackle jobs too special for the admirable tools that StrongED
already supplies.  By their nature they tend to be ephemeral.

The Lpeg library is very powerful but it is tough to use, and more
verbose.

Sad to say, I am getting old, and dropping out of sight as gracefully
as I can. I made a horrid mistake about a year ago which stripped
off the filetypes of much of my archived material. Not fatal, but
tedious to restore.

Best wishes
--
Gavin Wraith (gavin@xxxxxxxxxxxxxxx)
Home page: http://www.wra1th.plus.com/