pyebnf/primitive.py
def merged(self, other):
    """Returns a new ParseNode whose type is this node's type, and whose children are all the
    children from this node and the other whose length is not 0.
    """
    children = [c for c in itertools.chain(self.children, other.children) if len(c) > 0]
    # NOTE: Only terminals should have ignored text attached to them, and terminals shouldn't be
    #       merged (probably) so it shouldn't be necessary to copy of ignored -- it should always
    #       be None. But, we'll go ahead and copy it over anyway, recognizing that other's
    #       ignored text will be lost.
    return ParseNode(self.node_type,
                      children=children,
                      consumed=self.consumed + other.consumed,
                      ignored=self.ignored)
def merged(self, other):
    """Returns a new ParseNode whose type is this node's type, and whose children are all the
    children from this node and the other whose length is not 0.
    """
    children = [c for c in itertools.chain(self.children, other.children) if len(c) > 0]
    # NOTE: Only terminals should have ignored text attached to them, and terminals shouldn't be
    #       merged (probably) so it shouldn't be necessary to copy of ignored -- it should always
    #       be None. But, we'll go ahead and copy it over anyway, recognizing that other's
    #       ignored text will be lost.
    return ParseNode(self.node_type,
                      children=children,
                      consumed=self.consumed + other.consumed,
                      ignored=self.ignored)
Returns a new ParseNode whose type is this node's type, and whose children are all the
    children from this node and the other whose length is not 0.