[linux-l] flex

Peter Ross Peter.Ross at alumni.tu-berlin.de
Di Jun 29 02:01:09 CEST 2004


Axel Weiß wrote on Fri, Jun 25, 2004 at 15:22 +0200:
> Ein Problem tritt auf, wenn ich versuche, beide Parser (und Lexer)in
> ein Programm zu linken, weil das Symbol 'yytext_ptr' mehrfach vorliegt.

Aus flex(1)
http://www.freebsd.org/cgi/man.cgi?query=flex&apropos=0&sektion=0&manpath=FreeBSD+5.2-RELEASE+and+Ports&format=html

-Pprefix
	   changes the default yy prefix used by flex for all globally-vis-
	   ible  variable  and  function  names  to instead be prefix.  For
	   example, -Pfoo changes the name of yytext to footext.   It  also
	   changes  the  name  of  the default output file from lex.yy.c to
	   lex.foo.c.  Here are all of the names affected:

		  yy_create_buffer
		  yy_delete_buffer
		  yy_flex_debug
		  yy_init_buffer
		  yy_flush_buffer
		  yy_load_buffer_state
		  yy_switch_to_buffer
		  yyin
		  yyleng
		  yylex
		  yylineno
		  yyout
		  yyrestart
		  yytext
		  yywrap

	   (If  you	are  using  a  C++  scanner,  then  only  yywrap and
	   yyFlexLexer  are affected.)  Within your scanner itself, you can
           still refer to the global variables and functions  using either
	   version  of  their  name; but externally, they have the modified
	   name.

	   This option lets you easily link together multiple flex programs
	   into  the same executable.  Note, though, that using this option
	   also renames yywrap(), so you now must either provide  your  own
	   (appropriately-named)  version  of the routine for your scanner,
	   or use %option noyywrap, as linking with -ll no longer  provides
	   one for you by default.

Es gruesst
Peter

P.S. Sorry, wenn die Mail etwas fehlformatiert aussieht, sitze gerade in
einer Umgebung, wo ich den Webmailer benutzen muss.







Mehr Informationen über die Mailingliste linux-l