You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: