pyebnf/compiler.py
def _ast_op_concat_to_code(self, opr, *, ignore_whitespace, **kwargs):
    """Convert an AST concatenate op to python source code."""
    hoist_target = OP_CONCAT if ignore_whitespace else OP_WS_CONCAT
    operands = self._hoist_operands(opr.operands, lambda t: isinstance(t, OptreeNode) and t.opnode.operator is hoist_target)

    lines = ["concatenation(["]
    for op in operands:
      lines.extend(self._indent(self._ast_to_code(op, ignore_whitespace=ignore_whitespace)))
      lines[-1] += ","
    lines.append("], ignore_whitespace={})".format(bool(ignore_whitespace)))
    return lines
def _ast_op_concat_to_code(self, opr, *, ignore_whitespace, **kwargs):
    hoist_target = OP_CONCAT if ignore_whitespace else OP_WS_CONCAT
    operands = self._hoist_operands(opr.operands, lambda t: isinstance(t, OptreeNode) and t.opnode.operator is hoist_target)

    lines = ["concatenation(["]
    for op in operands:
      lines.extend(self._indent(self._ast_to_code(op, ignore_whitespace=ignore_whitespace)))
      lines[-1] += ","
    lines.append("], ignore_whitespace={})".format(bool(ignore_whitespace)))
    return lines
def _ast_op_concat_to_code ( self , opr , * , ignore_whitespace , * * kwargs ) : hoist_target = OP_CONCAT if ignore_whitespace else OP_WS_CONCAT operands = self . _hoist_operands ( opr . operands , lambda t : isinstance ( t , OptreeNode ) and t . opnode . operator is hoist_target ) lines = [ "concatenation([" ] for op in operands : lines . extend ( self . _indent ( self . _ast_to_code ( op , ignore_whitespace = ignore_whitespace ) ) ) lines [ - 1 ] += "," lines . append ( "], ignore_whitespace={})" . format ( bool ( ignore_whitespace ) ) ) return lines
Convert an AST concatenate op to python source code.
Convert an AST concatenate op to python source code .