--- Makefile.am +++ Makefile.am @@ -90,21 +90,22 @@ noinst_HEADERS = \ include_HEADERS = \ FlexLexer.h -EXTRA_DIST = \ - .indent.pro \ +dist_doc_DATA = \ AUTHORS \ COPYING \ - INSTALL \ NEWS \ ONEWS \ README \ README.cvs \ - THANKS \ - TODO \ + TODO + +EXTRA_DIST = \ + .indent.pro \ + ABOUT-NLS \ + INSTALL \ autogen.sh \ flex.skl \ mkskel.sh \ - ABOUT-NLS \ config.rpath \ gettext.h --- README.cvs +++ README.cvs @@ -16,15 +16,15 @@ files needed to make building flex easy are included. You don't have that in the cvs tree. You will need various external tools in order to build the distribution. Here is -a (hopefully complete and correct) list of the required tools. Always get the latest -version of each tool; we list the versions used in development of +a (hopefully complete and correct) list of the required tools. Always get the +latest version of each tool; we list the versions used in development of flex, but the listed versions may not work for you. compiler suite; e.g., gcc bash or some other fairly robust sh-style shell GNU bison; to generate parse.c from parse.y GNU m4 1.4; required by GNU autoconf (yes, it *must* be GNU m4) -GNU autoconf 2.59 and GNU automake 1.9.6; for generating Makefiles etc. +GNU autoconf 2.60 and GNU automake 1.10; for generating Makefiles etc. GNU gettext 0.14.5; for i18n flex (latest beta release); for bootstrap of scan.l help2man 1.36; to generate the flex man page --- configure.in +++ configure.in @@ -84,7 +84,7 @@ fi AC_FUNC_ALLOCA AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h stddef.h stdlib.h string.h strings.h unistd.h]) +AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h stddef.h stdlib.h string.h strings.h unistd.h regex.h]) AC_CHECK_LIB(m, log10) # The test test-pthread uses libpthread, so we check for it here, but --- doc/Makefile.am +++ doc/Makefile.am @@ -2,7 +2,7 @@ help2man = @HELP2MAN@ info_TEXINFOS = flex.texi dist_man_MANS = flex.1 -EXTRA_DIST = flex.pdf +dist_doc_DATA= flex.pdf CLEANFILES = \ flex.hks \ --- doc/flex.texi +++ doc/flex.texi @@ -1,8 +1,8 @@ \input texinfo.tex @c -*-texinfo-*- @c %**start of header @setfilename flex.info -@settitle Lexical Analysis With Flex @include version.texi +@settitle Lexical Analysis With Flex, for Flex @value{@version} @set authors Vern Paxson, Will Estes and John Millaway @c "Macro Hooks" index @defindex hk @@ -58,7 +58,7 @@ PURPOSE. @end copying @titlepage -@title @value{title} +@title Lexical Analysis with Flex @subtitle Edition @value{EDITION}, @value{UPDATED} @author @value{authors} @page @@ -354,7 +354,8 @@ Here's another simple example: . ++num_chars; %% - main() + + int main() { yylex(); printf( "# of lines = %d, # of chars = %d\n", @@ -382,7 +383,7 @@ A somewhat more complicated example: %{ /* need this for the call to atof() below */ - #include math.h> + #include %} DIGIT [0-9] @@ -416,9 +417,7 @@ A somewhat more complicated example: %% - main( argc, argv ) - int argc; - char **argv; + int main( int argc, char **argv ) { ++argv, --argc; /* skip over program name */ if ( argc > 0 ) @@ -1576,8 +1575,8 @@ condition remains unchanged; it does @emph{not} revert to @code{INITIAL}. @cindex yywrap, default for -@cindex nowrap, %option -@cindex %option nowrap +@cindex noyywrap, %option +@cindex %option noyywrapp If you do not supply your own version of @code{yywrap()}, then you must either use @code{%option noyywrap} (in which case the scanner behaves as though @code{yywrap()} returned 1), or you must link with @samp{-lfl} to @@ -1757,7 +1756,7 @@ treat it as a single token, the floating-point number @samp{123.456}: %% expect-floats BEGIN(expect); - [0-9]+@samp{.}[0-9]+ { + [0-9]+.[0-9]+ { printf( "found a float, = %f\n", atof( yytext ) ); } @@ -3402,7 +3401,7 @@ which degrade performance. These are, from most expensive to least: %option interactive %option always-interactive - @samp{^} beginning-of-line operator + ^ beginning-of-line operator yymore() @end verbatim @end example @@ -3887,12 +3886,16 @@ Here is an example of a simple C++ scanner: @cindex C++ scanners, use of @example @verbatim - // An example of using the flex C++ scanner class. + // An example of using the flex C++ scanner class. %{ + #include + using namespace std; int mylineno = 0; %} + %option noyywrap + string \"[^\n"]+\" ws [ \t]+ @@ -3916,7 +3919,7 @@ Here is an example of a simple C++ scanner: if(c == '\n') ++mylineno; - else if(c == @samp{*}) + else if(c == '*') { if((c = yyinput()) == '/') break; @@ -3926,23 +3929,23 @@ Here is an example of a simple C++ scanner: } } - {number} cout "number " YYText() '\n'; + {number} cout << "number " << YYText() << '\n'; \n mylineno++; - {name} cout "name " YYText() '\n'; + {name} cout << "name " << YYText() << '\n'; - {string} cout "string " YYText() '\n'; + {string} cout << "string " << YYText() << '\n'; %% int main( int /* argc */, char** /* argv */ ) - { - @code{flex}Lexer* lexer = new yyFlexLexer; + { + FlexLexer* lexer = new yyFlexLexer; while(lexer->yylex() != 0) ; return 0; - } + } @end verbatim @end example @@ -4565,7 +4568,7 @@ called again, you may get the following message: @cindex error messages, end of buffer missed @example @verbatim - fatal @code{flex} scanner internal error--end of buffer missed + fatal flex scanner internal error--end of buffer missed @end verbatim @end example --- filter.c +++ filter.c @@ -161,6 +161,7 @@ bool filter_apply_chain (struct filter * chain) * to sync the stream. This is a Hail Mary situation. It seems to work. */ close (pipes[1]); + clearerr(stdin); if (dup2 (pipes[0], fileno (stdin)) == -1) flexfatal (_("dup2(pipes[0],0)")); close (pipes[0]); --- flexdef.h +++ flexdef.h @@ -91,7 +91,9 @@ char *alloca (); #define true 1 #define false 0 #endif +#ifdef HAVE_REGEX_H #include +#endif #include "flexint.h" /* We use gettext. So, when we write strings which should be translated, we mark them with _() */ --- flexint.h +++ flexint.h @@ -28,7 +28,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -59,5 +58,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ #endif /* ! FLEXINT_H */ --- gen.c +++ gen.c @@ -1890,7 +1890,7 @@ void make_tables () outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\"); outn ("\t\t{ \\"); outn ("\t\tint c = '*'; \\"); - outn ("\t\tint n; \\"); + outn ("\t\tsize_t n; \\"); outn ("\t\tfor ( n = 0; n < max_size && \\"); outn ("\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\"); outn ("\t\t\tbuf[n] = (char) c; \\"); --- tests/test-pthread/Makefile.am +++ tests/test-pthread/Makefile.am @@ -27,7 +27,7 @@ CLEANFILES = scanner.c scanner.h parser.c parser.h $(testname)$(EXEEXT) OUTPUT $ OBJS = scanner.o # parser.o AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) -LDFLAGS = -lpthread +LIBS = -lpthread #LFLAGS = --header="scanner.h" #YFLAGS = --defines --output=parser.c @@ -37,7 +37,7 @@ scanner.c: $(srcdir)/scanner.l $(FLEX) $(LFLAGS) $< $(testname)$(EXEEXT): $(OBJS) - $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES) + $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) $(LOADLIBES) test: $(testname)$(EXEEXT) ./$(testname) $(srcdir)/test-*.input