On Wed, Dec 1, 2021 at 4:26 PM vitalije <[email protected]> wrote: > Idea: use tokenize python module...
This idea might work, but the attached script "wishes away" the difficulties involved in generating code. 1. Tokenizing the incoming lines (scan_line) is not the problem. The present code has no trouble discovering which lines start with 'class' or 'def'. 2. The theory of operation post <https://groups.google.com/g/leo-editor/c/oETfwToAvuk/m/lYGZy-6TBwAJ> shows that splitting lines into nodes involves tricky considerations of context. The python importer's code generators are: end_previous_blocks, do_def, do_class, do_normal_line, start_python_block, and gen_python_ref.* All *of the tests in these methods are strictly necessary. Unit tests will fail if any of these tests go missing! The attached script ignores these complexities. 3. Like it or not, the python importer *is* part of the ecosystem created by the Importer class. The vnode_info dict must exist and must contain *all* its data. *Summary* I am happy with the new python importer. The code generators are as simple as possible. The importer's unit tests won't pass with simpler code! The vnode_info dict guarantees that all necessary state data persists into the post pass. 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS3Y%2Bnfubd1JZ%2BXVcfZ0hg2CAH119Bx9VL_O8CDQ6rhJmg%40mail.gmail.com.
