Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment translation is unsupported #17

Open
redneckbeard opened this issue Feb 13, 2022 · 0 comments
Open

Comment translation is unsupported #17

redneckbeard opened this issue Feb 13, 2022 · 0 comments

Comments

@redneckbeard
Copy link
Owner

redneckbeard commented Feb 13, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant