Its been years since I used Antlr2, now its Antlr4. I'm modifying the tsql parser and would like to keep block and line comments in the parse tree.
Most grammar's lexer rules push comments to a hidden channel or skip eg:
BLOCK_COMMENT: '/*' (COMMENT | .)*? '*/' -> channel(HIDDEN);
LINE_COMMENT: '//' ~[\r\n]* -> skip;
Since comment occur on any line, or in the middle of a line, how can I keep the comments in the parse tree ?