help-flex
[Top][All Lists]
Advanced

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

%option header (Was Re: flex 2.5.13 released)


From: Bruce Lilly
Subject: %option header (Was Re: flex 2.5.13 released)
Date: Fri, 16 Aug 2002 05:11:42 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

John Millaway wrote:
# make mailparse
flex -d -Caem -8 -Pmail -s  mail_lex.l
make: *** [lex.mail.c] Segmentation fault (core dumped)


This bug has been fixed and committed. Here is the patch:
[...]

Thanks, John.  I applied the patch to 2.5.14.

Now, back to the flex-generated header issues:

1. yyset_debug is redefined with the prefix if specified,
   then is conditionally declared, and then is unconditionally
   #undef'ed.  That doesn't work -- it shouldn't be #undef'ed.
   Ditto for yyset_extra, yyget_out, yyset_out, etc.

2. start conditions are unconditionally #undef'ed. That is
   very bad -- even if I specifically define the start conditions
   separately from the flex-generated header, all that work is
   undone by the unconditional #undefs.

3. Some declarations etc. can be avoided by setting macros such as
   YY_NO_GET_LVAL.  But others are unconditional.  It would be
   nice to be able to avoid the following, none of which are
   needed (outside of the generated .c file) in my application, and
   all of which are unconditionally defined in the header [and
   many of which are pointless as they are subsequently unconditionally
   #undef'ed in the header]:
   YY_LESS_LINENO
   yyless
   yy_set_interactive
   yy_set_bol
   YY_INPUT
   yyterminate
   YY_START_STACK_INCR
   YY_FATAL_ERROR
   YY_USER_ACTION
   YY_BREAK
   YY_RULE_SETUP

4. There are a bunch of comments that seem to add little but clutter:
   various /* %c */, /* %+ */, /* %* */, etc. yy_get_next_buffer,
   yy_get_previous_state, etc.

5. There are munged versions of start condition names...
   a. I don't need munged versions; it would be nice to be able to
      avoid them to prevent namespace clashes
   b. I do need the real start condtion definitions (currently
      I extract them from the .c file via sed, but see #2 above).
      These could be conditionally included by an #ifndef wrapper...
   c. The munging is inconsistent w.r.t. case (FOOSC_INITIAL vs.
      foosc_Bar).

6. A number of useful macros are unconditionally #undefed. In
   addition to the start conditions and ones specifically mentioned
   above, the following probably shouldn't be undef'ed, or at least
   there should be a wrapper to provide user choice:
   FLEX_SCANNER
   FLEX_MAJOR_VERSION
   FLEX_MINOR_VERSION
   YY_REENTRANT
   YY_REENTRANT_BISON_PURE
   yylex

7. The yylval macro should be wrapped to prevent redefinition
   warnings (bison defines it if generating the parser with
   a prefix).





reply via email to

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