redneckbeard / thanos

Ruby -> Go at the snap of your fingers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comment translation is unsupported

redneckbeard opened this issue · comments

The Ruby parse tree stores all comments by line number, and every node is annotated with the source line number, but the Go stdlib's AST package makes it exceedingly difficult to insert them -- essentially by byte offset from the beginning of the file, which does not exist as we are building the target. I think that the only way to get them into the target is to supply the token.Pos by dumping a given section of the target AST to string as you go, evaluating its length, adding comments at that position if one corresponds to the ruby line number, and increment a position variable accordingly.