pyebnf/compiler.py
def _remove_grouping_groups(self, optree):
    """Grouping groups are implied by optrees, this function hoists grouping group expressions up
    to their parent node.
    """
    new_operands = []
    for operand in optree.operands:
      if isinstance(operand, OptreeNode):
        new_operands.append(self._remove_grouping_groups(operand))
      elif isinstance(operand, GroupingGroup):
        new_operands.append(operand.expression)
      else:
        new_operands.append(operand)

    return OptreeNode(optree.opnode, new_operands)
def _remove_grouping_groups(self, optree):
    """Grouping groups are implied by optrees, this function hoists grouping group expressions up
    to their parent node.
    """
    new_operands = []
    for operand in optree.operands:
      if isinstance(operand, OptreeNode):
        new_operands.append(self._remove_grouping_groups(operand))
      elif isinstance(operand, GroupingGroup):
        new_operands.append(operand.expression)
      else:
        new_operands.append(operand)

    return OptreeNode(optree.opnode, new_operands)
Grouping groups are implied by optrees, this function hoists grouping group expressions up
    to their parent node.