Is there a reason why you can't make the lexer capture the comments?
Then in the context where a comment may have some effect, check using
the parser action whether a comment was saved by the lexer.
If the comment always may have an action regardless of context, attach
the action to the lexer rule.