When having multiple lexers one sees that, especially, in the pattern part some definitions are repeated in each lexer (e.g. whiteSpace [ \t]+
), this is not nice that one has to do define it each time and especially with more complex patterns a bit error prone.
So far I have not been able to fine anything, but is there a way to have a file with (e.g.) patterns included in a lexer?
You are free to write your own preprocessor, and I suspect many people have done so. But as far as I know, no popular lex derivative includes such a feature. Certainly, neither flex nor the original AT&T lex have one.