pyebnf/compiler.py
def _ast_op_alternate_to_code(self, opr, **kwargs):
    """Convert an AST alternate op to python source code."""
    hoist_target = OP_ALTERNATE
    operands = self._hoist_operands(opr.operands, lambda t: isinstance(t, OptreeNode) and t.opnode.operator is hoist_target)

    lines = ["alternation(["]
    for op in operands:
      lines.extend(self._indent(self._ast_to_code(op)))
      lines[-1] += ","
    lines.append("])")
    return lines
def _ast_op_alternate_to_code(self, opr, **kwargs):
    """Convert an AST alternate op to python source code."""
    hoist_target = OP_ALTERNATE
    operands = self._hoist_operands(opr.operands, lambda t: isinstance(t, OptreeNode) and t.opnode.operator is hoist_target)

    lines = ["alternation(["]
    for op in operands:
      lines.extend(self._indent(self._ast_to_code(op)))
      lines[-1] += ","
    lines.append("])")
    return lines
def _ast_op_alternate_to_code ( self , opr , * * kwargs ) : hoist_target = OP_ALTERNATE operands = self . _hoist_operands ( opr . operands , lambda t : isinstance ( t , OptreeNode ) and t . opnode . operator is hoist_target ) lines = [ "alternation([" ] for op in operands : lines . extend ( self . _indent ( self . _ast_to_code ( op ) ) ) lines [ - 1 ] += "," lines . append ( "])" ) return lines
Convert an AST alternate op to python source code.
Convert an AST alternate op to python source code .