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

Re: Bug#189332: flex: unput(char) not valid outside body of grammar

Manoj Srivastava <srivasta@debian.org> writes:

>  [POSIX] also says that it is unspecified whether the functions or
>  macros appear in the C code output of lex, or are accessible only
>  through the -l l operand of the c compiler. 

Yes.  This means that if Bison were trying to be portable to all lex
variants, Bison would have to link itself with -ll for the lex
variants that define unput etc. in the lex library.  Bison assumes
flex, though, so it doesn't have to worry about that possibility.

One other problem I've observed is that flex 2.5.31 defines
yylex_destroy even if the application doesn't need yylex_destroy.
There is no %option noyylex_destroy.

>  the modification I provided was tested, and it did not
>  call yyunput before it was declared (the trick is to place the
>  functions in the _rules_ section in %{ %} stanzas. 

That modification relies on nested functions, which is not portable.
Bison is supposed to be portable to any ANSI C compiler, so it can't
use that technique.

Reply to: