I want to have two lexers in one project, and I don't want to run into problems with hav开发者_C百科ing multiple yylex functions in the build. Can I make lex output with a different prefix?
You can use the -Pprefix
parameter for flex in your makefile. Using flex -Pfoo
you would effectively prefix all yy generated functions. Have a look at the manual page for further details.
flex lets you do that. Just define the YY_DECL macro. Dunno about actual Unix(tm) lex(1) though.
You could build a C++ lexer. This means all the state information is held in an object.
Then it is just a matter of using the correct object!
精彩评论