At some point in the not-too-distant past, I imported a python file into 
Leo that had many decorators for function defs.  The decorators were put 
into the last line of the preceding node, not the first line of a function 
def node.  This may have worked when the external file was run, but it 
certainly isn't what one wants.

I just made up a little test Python file with decorators for all the 
function defs and imported it.  The decorators were correctly inserted as 
the first line of each function def node.  So in this one respect, at 
least, the new Python importer works more correctly than the old.

On Sunday, July 31, 2022 at 7:20:31 AM UTC-4 Edward K. Ream wrote:

> For the last several days I have been revising *all* of Leo's importers. 
> At present the C, Python and coffeescript importers work properly, but 
> yesterday I realized that Importer.*make_node* must be generalized.
>
> Indeed, Vitalije's version of this method used indentation as a proxy for 
> bracket level. This is valid for python and coffeescript, but not valid for 
> most other languages.
>
> Most unit tests indent brackets consistently. Fortunately one test does 
> not, which revealed the hidden assumption. It's tricky to generalize 
> make_node, but I'm confident that it can be done cleanly. A new 
> *decl_level* field in the block_tuple (the node descriptor tuple) 
> decouples bracket level from indentation.
>
> We aren't going back. The new importer world is way better than the old. 
> Thank you Vitalije!
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/07c4471e-82df-42e0-80c8-39740129e2f0n%40googlegroups.com.

Reply via email to