mbj/unparser — pull request #10 by misfo (2013-09-06 04:50:55+00:00)
Title: Roughed out comment preservation

Hello, hello! I've been hacking on a comment preservation a bit and I wanted to get some feedback. I still need to document this and clean up some stuff (especially busting `Emitter#emit_surrounding_comments` into smaller pieces). But I wanted to see what you thought about this approach from a high level.

All standard comments are correctly preserved and indented. "Document" comments are preserved as well. For cases where unparser is collapsing lines from the source together, the code will concatenate comments as needed:

```ruby
1 + # a
2
```

becomes:

```ruby
1 + 2 # a
```

and

```ruby
1 + # a
2 # b
```

becomes:

```
1 + 2 # a # b
```

Since block comment delimiters cannot appear on a line with code or be indented

```ruby
1 +
=begin
a
=end
2
```

becomes:

```ruby
1 + 2
=begin
a
=end
```