On Thu, Oct 23, 2008 at 3:36 PM, drmikecrowe <[EMAIL PROTECTED]> wrote:
> So, my biggest question is: How do I scan the classes, and scan the > functions within the classes? I've been through the pythonParser > routine, but I don't quite see yet how it does it. Almost all the work is done in the baseScannerClass parser methods. 'scan' is the outermost method. As the comment says, it uses language-specific helpers. The real work is done in Code-->Core classes-->@thin leoImport.py--><< class baseScannerClass >>-->Parsing-->startsClass/Function (baseClass) & helpers This is complicated, as it must be. Many of the complications are in startsHelper. Subclasses of baseScannerClass basically "hack" (change the operation of) startsHelper by setting various ivars **or** by overriding the methods that startsHelper calls. For example, the python parser overrides several methods. So, the big picture is that you must make startsHelper do the right thing for a particular language. In an emergency, you could override startsHelper itself, but that should not be necessary. When I'm unsure about what is going on, I write a *small* test file, and then enable tracing in startsHelper by setting trace = True (and maybe verbose = True). You could also set a breakpoint (call g.pdb()) at the start of startsHelper and single step through the code to see exactly what is happening. If you like, you could trace through, say, a small python file to see what is going on for the Python parser. Note that python is trickier because it uses indentation to delimit syntax, which is why Python overrides skipCodeBlock. In short, startsHelper is where the action is. Once you have parsing under control, the next step is to modify code generation if necessary to produce the proper "output", that is, the text of the nodes in the Leo outline. Edward --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
