开发者

Can I get lex to put out a yylex() function with a different name?

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜