On Friday, January 17, 2014 10:28:07 AM UTC-6, Edward K. Ream wrote:

> ​I am going to completely rewrite phase 2...
The new phase 2 code will treat all (parent) nodes in the same way.

Some more details

1. There is probably no need for the distinction between 
@existing-organizer: and @organizer nodes.  The write code will create an 
@organizer node for *any* node having children.  The read code will ignore 
@organizer nodes (and their unls) for nodes that have children created by 
the importer.  A very nice collapse in complexity.

2. There are several (ultimately equivalent) ways of having vc.demote 
traverse the outline.  Using the c.all_positions iterator or 
p.moveToThreadNext would be certainly be possible, but it might actually be 
simpler (because more explicit) to duplicate the logic in 
p.moveToThreadNext.  Here it is:

    def moveToThreadNext (self):
        p = self
        if p.v:
            if p.v.children:
                p.moveToFirstChild()
            elif p.hasNext():
                p.moveToNext()
            else:
                p.moveToParent()
                while p:
                    if p.hasNext():
                        p.moveToNext()
                        break #found
                    p.moveToParent()
                # not found.
        return p

The point is that the calls to p.moveToParent() and  p.moveToFirstChild() 
would provide places to push and pop entries from the simulated unl stack.  
It's a good thought experiment.  However, it will probably be simpler to 
get the same effect by comparing the old and new values of len(p.stack) as 
the iterator traverses the tree.

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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to