-
Committer:
Edward K. Ream
-
Date:
2009-10-13 20:53:50 UTC
-
Revision ID:
edreamleo@gmail.com-20091013205350-tgzb73qefp7tuj1g
Added "prototype of using patternmatch library" to test.leo
This work has been mostly abandoned.
The idea was to use icon-like patterns, based on
http://www.wilmott.ca/python/patternmatching.html
There are several problems with this approach:
1. This library, while elegant, isn't necessarily so useful.
Indeed, the typical "find script" in scripts.leo uses
either the string method s.find (or s.findr) or similar
g.match methods.
2. Unlike the python regex module, there do not appear to
be the equivalent of search or findall methods. This
means that the search code must either
a) step through the search string explicitly or
b) use more complicated search patterns that match anywhere.
3. Search scripts are typically more complex than other @button scripts.
The search scripts in scripts.leo avoid this problem by doing all
the replacements at once, without prompts.
State of the prototype code:
- @@button find script a kinda works, but it only finds patterns at
the start of body text. It does shows that generators are useful.
- @@button create find button doesn't do anything, and it's not clear
that is can ever be extended to be useful.
The idea of this button was that clicking on a node, say "pat a",
containing an icon-like script, would create *another* @button node,
say "@button pat-find pat a" that would (interactively?) find all
nodes matched by the script in "pat a". This isn't going to be easy.