"Leftist NodeBuilders" are now supported.
That is, "nb << a << b << c << OR << d << AND" turns into
(AND (OR a b c) d)
The rule is: pushing a kind onto a NodeBuilder with a nonzero
number of child Nodes in it, the action "collapses" it. If a
kind is already associated to the NodeBuilder, it is an error.
Thus:
NodeBuilder<> nb(AND); nb << AND;
and
NodeBuilder<> nb; nb << AND << OR;
are both errors (if assertions are on).
In reality, though, the implementation is trickier, as the collapsing
is done lazily on the following push. This complicates things a bit,
but by placing an Assert(false), I found that we aren't depending on
the old behavior (at least for any unit tests or regressions in the
source tree). The Assert(false) is now removed and leftist
NodeBuilders are in business.
Fixes bug 101.