When the flex C++ scanning class rewrite finally happens, then this sort of thing should become much easier.
You can do this by passing the various functions (such as
iostream*’s, and then
dealing with your own I/O classes surreptitiously (i.e., stashing them in
special member variables). This works because the only assumption about
the lexer regarding what’s done with the iostream’s is that they’re
ultimately passed to
LexerOutput, which then do whatever
is necessary with them.