Language translation comment handling

40 views Asked by At

I am writing a translator using antlr 4 and string templates. I have put the comments on a separate channel, and am using the visitor pattern to pass the templates around. I now want to output the comments in the translated code. Does anyone have any suggestions about the easiest way of doing this?

One idea I had was to create a comment template which would hold any comments and the template from lower level visitors. However this means I will need to add a check for comments in each visitor method.

0

There are 0 answers