On Feb 26, 7:54 pm, "Edward K. Ream" <[email protected]> wrote:
> The bath revealed that it would not be so easy to discover the extent > of a class in a .leo outline. I considered various ways to do the > parsing, before realizing that no parsing *at all* is needed. Truly, > the program is as simple as a simple scanner. Somehow, this post got sent too early. I'll go on... scanHelper in leoImport.py is an example of the kind of scanner I am thinking of. The actual python scanners will likely be even a bit simpler. The point is that the scanner must recognize Python comments and all flavors of Python strings. pep8 must also recognize identifiers. Now here is the interesting part. The "global" part of pep8 must distinguish between different kinds of identifiers: ivars, class names, method names, etc. The Aha is that no real parsing is required: local context will tell us most of what we need to know: - class names follow the 'class' statement. - functions and methods follow defs. - If necessary, we can look to see if a name is followed by an open paren. If it is, it is a function or method. So this is really good. We have everything we need to create a symbol table without *any* parsing (context) whatever. As I said before, first pass of the global fixer will create a global symbol table. A new Aha is that pep8 can and should do nothing if a renaming would create a collision. Such collisions are probably rare, and if they do occur the user probably should fix the problem by hand. Experimentation might suggest other strategies, but for now this is the simplest thing that could possibly work, and it is likely to be good enough. In short, it should be possible to demonstrate a prototype (with unit tests) in just a few hours. Edward P.S. Any time you can convert a month-long project into a few-hour- long project these is a *big* release of energy. That's why this is so exciting. P.P.S. As I said earlier, a lot of packaging might be needed to create a finished product. But that can be done after the prototype passes the defining unit tests. At that point, the project has *already* succeeded. Further work is risk-free. EKR -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.
