On Friday, November 18, 2016 at 11:57:46 AM UTC-6, Edward K. Ream wrote:
The work on importers is an "architectural" phase. I'm attempting to use
> common (base class) code where appropriate.
>
I am now convinced that essentially *all* the code for *all* importers can
be placed (without hacks) in the base Importer class. This is big.
Part of this will be normal, grind-it-out, simplification.
But an unexpected Aha helps a lot:
Aha: context *never* matters when comparing states.
It doesn't matter whether a line begins or ends in a string: the comparison
with the previous line will still be valid.
And the comparison can be used *directly* to tell the scanner whether to
begin or end a block.
This is going to collapse a lot of code. States will now define a *level*
method. For Python and coffeescript, this will be self.indent. For other
languages, it can be an int or a tuple of ints.
The level could be (self.curlies, self.parens, self.squares)
In this case, { dominates ( dominates [, because that's how Python's tuple
comparison works.
Or the level could just be self.curlies + self.parens + self.squares. In
that case, all kinds of brackets are equal.
But it doesn't much matter. Regardless of how level is defined (and
regardless of source language) comparisons such as:
next_state.level() > prev_state.level()
will just work. No more rich text comparisons. Much simpler
starts/continues_block methods, if they are needed at all.
It's going to take more hours to put this all in place, but the results
should be spectacular. With luck, *all* Importers will use i.v2_scan_line
and i.v2_gen_lines. No exceptions!
This is worth *any* amount of work.
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.