How do I combine fuzzy parsing and stream rewriting?

If you want to parse just pieces of, say, a Java file using filter mode (fuzzy parsing) and do some replacement like TokenRewriteStream does, how can you do it? TokenRewriteStream requires use of a parser/lexer combo whereas filter=true does everything with the scanner. Just match what you want then include print statements and actions to alter the text. Anything not matched by your rule or rules should be matched by an EVERYTHING_ELSE rule, which simply emits all characters verbatim.

@@ to
<begin lang="grammar">
        :       '@grammar' '\n'
                {out.println("<begin lang=\"grammar\">");}

    :   c=.             {out.print((char)c);}