pyebnf/compiler.py
def _ast_op_multiply_to_code(self, opr, ignore_whitespace=False, **kwargs):
    """Convert an AST multiply op to python source code."""
    opl, opr = opr.operands

    if isinstance(opl, Number):
      times = opl.value
      subject = self._ast_to_code(opr)
    else:
      times = opr.value
      subject = self._ast_to_code(opl)

    lines = ["repeated("]
    lines.extend(self._indent(subject))
    lines[-1] += ","
    lines.append("{0}times={1},".format(self.indent, times))
    lines.append("{0}ignore_whitespace={1}".format(self.indent, bool(ignore_whitespace)))
    lines.append(")")
    return lines
def _ast_op_multiply_to_code(self, opr, ignore_whitespace=False, **kwargs):
    opl, opr = opr.operands

    if isinstance(opl, Number):
      times = opl.value
      subject = self._ast_to_code(opr)
    else:
      times = opr.value
      subject = self._ast_to_code(opl)

    lines = ["repeated("]
    lines.extend(self._indent(subject))
    lines[-1] += ","
    lines.append("{0}times={1},".format(self.indent, times))
    lines.append("{0}ignore_whitespace={1}".format(self.indent, bool(ignore_whitespace)))
    lines.append(")")
    return lines
def _ast_op_multiply_to_code ( self , opr , ignore_whitespace = False , * * kwargs ) : opl , opr = opr . operands if isinstance ( opl , Number ) : times = opl . value subject = self . _ast_to_code ( opr ) else : times = opr . value subject = self . _ast_to_code ( opl ) lines = [ "repeated(" ] lines . extend ( self . _indent ( subject ) ) lines [ - 1 ] += "," lines . append ( "{0}times={1}," . format ( self . indent , times ) ) lines . append ( "{0}ignore_whitespace={1}" . format ( self . indent , bool ( ignore_whitespace ) ) ) lines . append ( ")" ) return lines
Convert an AST multiply op to python source code.
Convert an AST multiply op to python source code .