I have a simple \"language\" that I\'m using Flex(Lexical Analyzer), it\'s like this:
/* Just like UNIX wc */
%{
int chars = 0;
int words = 0;
int lines = 0;
I prefer to define my own yywrap(). I'm compiling with C++, but the point should be obvious. If someone calls the compiler with multiple source files, I store them in a list or array, and then yywrap() is called at the end of each file to give you a chance to continue with a new file.
int yywrap() {
// open next reference or source file and start scanning
if((yyin = compiler->getNextFile()) != NULL) {
line = 0; // reset line counter for next source file
return 0;
}
return 1;
}