Support macros

This adds three directives:

- `@macro (name)`: Starts recording a macro identified by 'name'
- `@endmacro`: Stops recording a macro
- `@do (name, kwargs)`: "Execute" the macro identified by 'name' by replacing the
  directive by the recorded macro contents, using kwargs to format the lines
Comment why this is reversed. Also might want to store a copy of lines instead of modifying it in-place. `self.lines = list(reversed(lines))` should work.