help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug: %option main overrides %option yywrap


From: John W. Millaway
Subject: Bug: %option main overrides %option yywrap
Date: Wed, 25 Apr 2001 09:54:39 -0700 (PDT)

Hello,

There is a "bug" in the current version of flex (2.5.4) in which the %option
[no]main unconditionally sets the %option [no]yywrap. I use the term "bug"
hesitantly, because this behavior appears to be intentional. However, I can't 
think
of any use for it other than to cause unexpected link errors when yywrap() is 
not
found.

Example:

  %option noyywrap  /* Disable option yywrap. */
  %option nomain    /* Option yywrap is now enabled! */

One workaround is to always specify %option yywrap AFTER %option main. In 
general,
if the user explicitly sets an option, then flex should either honor that 
setting,
or report a conflict.

The bug is in "scan.l" at line 247, and is undocumented.

244:    lex-compat      lex_compat = option_sense;
245:    main            {
246:                    action_define( "YY_MAIN", option_sense );
247:                    do_yywrap = ! option_sense;
248:                    }
249:    meta-ecs        usemecs = option_sense;

-John Millaway


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]