Next: , Previous: , Up: FAQ   [Contents][Index]

How do I use my own I/O classes in a C++ scanner?

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 LexerInput() and LexerOutput()) NULL 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 LexerInput() and LexerOutput, which then do whatever is necessary with them.