On Wednesday, May 10, 2023 at 5:53:05 AM UTC-5 Edward K. Ream wrote:

> *Aha!* Let's use *helper lines* to simplify the analysis. 

Wow. This Aha has collapsed the complexity of *all* parts of the C++ 
importer.

Without line states, the code generators are dead simple! Take a look at 
*i_c.gen_lines* in PR #3330 
<https://github.com/leo-editor/leo-editor/pull/3330/files>.
 

We'll create the helper lines as follows:

- Start with the lines from the original file.
- Remove comments and strings. 

- Remove curly brackets associated with 'if', 'for', and 'while' statements.
- Check the result to ensure that parens and brackets are properly nested.


The *c_i.delete_comments_and_strings* method handles all complexities 
involved in a sound, straightforward manner. The code generators see *none* 
of these complications!!!

As you can see, this method is completely general, so it will eventually 
migrate to the base Importer class.

*Summary*

I'll eventually rewrite almost all the importers to use this new design 
pattern.

This is the way importers are written in The Book.

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/7f5c44dc-1b92-496b-90ed-17b59d9e4288n%40googlegroups.com.

Reply via email to