On Jun 23, 5:44 pm, "Edward K. Ream" <[email protected]> wrote:

> I expect it will take several days at least to complete the read logic
> so that it passes significant unit tests.  Imo, this work is well
> worth doing.

A big breakthrough with the read code is now on the trunk at rev
3137.  The Aha is that all input lines (be they sentinels or plain
lines) add text to the end at.v.b, that is, to the end of the "current
vnode".  I'm not sure why I didn't see this before.

This Aha eliminates a lots of nasty code that tried to terminate
"open" nodes when a new @+node sentinel is seen.  At any point, we
only need to know what at.v is.  But that's easy.  at.v changes when
we see a +node sentinel, or when we see a -others or -<< sentinel.  A
new stack saves and restores at.v when we see section references and
@others.  This is the simplest thing that could possibly work.  And
indeed it did work the first time.

Rather than queuing lines to the at.out array, the new code calls
at.appendToOut().  For efficiencies sake, this method doesn't actually
append new lines to at.v.b: that would heavily stress the gc.
Instead, at.appendToOut appends lines to at.v.tempBodyList, creating
this ivar if necessary.

At the end of the read logic, after all nodes have been created, the
existing at.copyAllTempBodyStringsToTnodes sets v.b to
at.v.tempBodyString + ''join.(v.tempBodyList).  Similarly, the
existing at.deleteAllTempBodyStrings deletes both v.tempBodyList and
v.tempBodyString.

This sounds complicated, but isn't.  In fact, lots of really
complicated code (and associated stacks) has just disappeared, or soon
will disappear.

Much more testing is needed, but this is the Aha I have been looking
for.

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.

Reply via email to