>> On Fri, 18 Apr 2003 00:50:08 -0700 (PDT), >> Paul Eggert <[EMAIL PROTECTED]> said:
> This email is following up to a Debian bug report about flex >> http://bugs.debian.org/189332>, which reports that flex test >> http://bugs.debian.org/189332>version > 2.5.31 breaks Bison 1.875. >> From: Manoj Srivastava <[EMAIL PROTECTED]> Date: Date: Wed, 16 >> Apr 2003 17:40:13 -0500 > This change means that flex no longer conforms to POSIX > 1003.1-2001. The POSIX specification for lex >> http://www.opengroup.org/onlinepubs/007904975/utilities/lex.html> > says that the functions yylex, yymore, yyless, input, and unput are > all accessible to user code included in the lex input. As far as I > can tell, POSIX imposes no restriction that the functions are > accessible only to user actions. > The change to flex may be necessary for reentrant scanners, but it > shouldn't be necessary for traditional scanners such as those > specified by POSIX. Indeed. The full POSIX references are: ISO/IEX 9945-2: 1993(3) Information Technology -- POSIX IEEE Std 1003.2-1992 Part 2: Shell and Utilities A.2.7.5 lex Actions It 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 og the c compiler. I have, however, noticed something bizarre: adding a %nounput options defines unput, but never undefines it, this seems like a bug somewhere. ---------------------------------------------------------------------- %{ /* A template scanner file to build "scanner.c". */ #include <stdio.h> #include <stdlib.h> #include "config.h" /*#include "parser.h" */ static void f(const char *x); %} %option 8bit outfile="scanner.c" prefix="test" %option nomain noyywrap nounput %option warn %% %{ void f(const char *x) { unput(*x); } %} [0-9] { unput('?'); } [a-z] { f("?"); }