| 658 | |
| 659 | |
| 660 | class CodeNode: |
| 661 | def __init__(self, stmt, block, begin_indent=""): |
| 662 | # compensate one line for $code: |
| 663 | self.code = "\n" + block |
| 664 | |
| 665 | def emit(self, indent, text_indent=""): |
| 666 | import re |
| 667 | |
| 668 | rx = re.compile("^", re.M) |
| 669 | return rx.sub(indent, self.code).rstrip(" ") |
| 670 | |
| 671 | def __repr__(self): |
| 672 | return "<code: %s>" % repr(self.code) |
| 673 | |
| 674 | |
| 675 | class StatementNode: |