Index: doc/flex.texi
--- doc/flex.texi.orig	2006-02-20 18:30:19 +0100
+++ doc/flex.texi	2006-02-23 15:27:26 +0100
@@ -3807,6 +3807,7 @@
 @example
 @verbatim
         // An example of using the flex C++ scanner class.
+    %option noyywrap
 
     %{
     int mylineno = 0;
@@ -3835,7 +3836,7 @@
                 if(c == '\n')
                     ++mylineno;
 
-                else if(c == @samp{*})
+                else if(c == '*')
                     {
                     if((c = yyinput()) == '/')
                         break;
@@ -3845,19 +3846,19 @@
                 }
             }
 
-    {number}  cout  "number "  YYText()  '\n';
+    {number}  std::cout <<  "number " <<  YYText() <<  '\n';
 
     \n        mylineno++;
 
-    {name}    cout  "name "  YYText()  '\n';
+    {name}    std::cout <<  "name " <<  YYText()  << '\n';
 
-    {string}  cout  "string "  YYText()  '\n';
+    {string}  std::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;
Index: flex.skl
--- flex.skl.orig	2006-02-16 23:20:43 +0100
+++ flex.skl	2006-02-23 15:32:55 +0100
@@ -916,6 +916,18 @@
 void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
 ]])
 
+m4_ifdef( [[M4_YY_REENTRANT]],
+[[
+m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
+[[
+int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
+[[
+void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );
+]])
+]])
+
 %if-bison-bridge
 m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
 [[
@@ -1140,9 +1152,9 @@
     m4_dnl  The bison pure parser is used. Redefine yylex to
     m4_dnl  accept the lval parameter.
 
-    m4_define( [[M4_YY_LEX_PROTO]],
+    m4_define( [[M4_YY_LEX_PROTO]], [[\]]
                [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
-    m4_define( [[M4_YY_LEX_DECLARATION]],
+    m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
                [[YYFARGS1(YYSTYPE *,yylval_param)]])
 ]])
 
@@ -1150,9 +1162,9 @@
 [[
     m4_dnl  Locations are used. yylex should also accept the ylloc parameter.
 
-    m4_define( [[M4_YY_LEX_PROTO]],
+    m4_define( [[M4_YY_LEX_PROTO]], [[\]]
                [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
-    m4_define( [[M4_YY_LEX_DECLARATION]],
+    m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
                [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
 ]])
 
@@ -2800,8 +2812,10 @@
 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
 [[
     /* Destroy the start condition stack. */
+     if (YY_G(yy_start_stack) != NULL) {
         yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
         YY_G(yy_start_stack) = NULL;
+     }
 ]])
 
 m4_ifdef( [[M4_YY_USES_REJECT]],
Index: main.c
--- main.c.orig	2006-02-14 19:55:42 +0100
+++ main.c	2006-02-23 15:27:46 +0100
@@ -211,6 +211,7 @@
 #if ENABLE_NLS
 #if HAVE_LOCALE_H
 	setlocale (LC_MESSAGES, "");
+	setlocale (LC_CTYPE, "");
 	textdomain (PACKAGE);
 	bindtextdomain (PACKAGE, LOCALEDIR);
 #endif
@@ -1159,7 +1160,6 @@
 			break;
 
 		case OPT_NO_UNISTD_H:
-			//buf_strdefine (&userdef_buf, "YY_NO_UNISTD_H", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_UNISTD_H",0);
 			break;
 
@@ -1274,7 +1274,6 @@
 			break;
 
 		case OPT_STACK:
-			//buf_strdefine (&userdef_buf, "YY_STACK_USED", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_STACK_USED",0);
 			break;
 
@@ -1331,87 +1330,66 @@
             break;
 
 		case OPT_NO_YY_PUSH_STATE:
-			//buf_strdefine (&userdef_buf, "YY_NO_PUSH_STATE", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_PUSH_STATE",0);
 			break;
 		case OPT_NO_YY_POP_STATE:
-			//buf_strdefine (&userdef_buf, "YY_NO_POP_STATE", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_POP_STATE",0);
 			break;
 		case OPT_NO_YY_TOP_STATE:
-			//buf_strdefine (&userdef_buf, "YY_NO_TOP_STATE", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_TOP_STATE",0);
 			break;
 		case OPT_NO_UNPUT:
-			//buf_strdefine (&userdef_buf, "YY_NO_UNPUT", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_UNPUT",0);
 			break;
 		case OPT_NO_YY_SCAN_BUFFER:
-			//buf_strdefine (&userdef_buf, "YY_NO_SCAN_BUFFER", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BUFFER",0);
 			break;
 		case OPT_NO_YY_SCAN_BYTES:
-			//buf_strdefine (&userdef_buf, "YY_NO_SCAN_BYTES", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BYTES",0);
 			break;
 		case OPT_NO_YY_SCAN_STRING:
-			//buf_strdefine (&userdef_buf, "YY_NO_SCAN_STRING", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_STRING",0);
 			break;
 		case OPT_NO_YYGET_EXTRA:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_EXTRA", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_EXTRA",0);
 			break;
 		case OPT_NO_YYSET_EXTRA:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_EXTRA", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_EXTRA",0);
 			break;
 		case OPT_NO_YYGET_LENG:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_LENG", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LENG",0);
 			break;
 		case OPT_NO_YYGET_TEXT:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_TEXT", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_TEXT",0);
 			break;
 		case OPT_NO_YYGET_LINENO:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_LINENO", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LINENO",0);
 			break;
 		case OPT_NO_YYSET_LINENO:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_LINENO", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LINENO",0);
 			break;
 		case OPT_NO_YYGET_IN:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_IN", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_IN",0);
 			break;
 		case OPT_NO_YYSET_IN:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_IN", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_IN",0);
 			break;
 		case OPT_NO_YYGET_OUT:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_OUT", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_OUT",0);
 			break;
 		case OPT_NO_YYSET_OUT:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_OUT", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_OUT",0);
 			break;
 		case OPT_NO_YYGET_LVAL:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_LVAL", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LVAL",0);
 			break;
 		case OPT_NO_YYSET_LVAL:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_LVAL", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LVAL",0);
 			break;
 		case OPT_NO_YYGET_LLOC:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_LLOC", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LLOC",0);
 			break;
 		case OPT_NO_YYSET_LLOC:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_LLOC", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LLOC",0);
 			break;
 
@@ -1564,11 +1542,10 @@
 
 	if (reject){
         out_m4_define( "M4_YY_USES_REJECT", NULL);
-		//outn ("\n#define YY_USES_REJECT");
     }
 
 	if (!do_yywrap) {
-		outn ("\n#define yywrap(n) 1");
+		outn ("\n#define yywrap(M4_YY_CALL_ONLY_ARG) 1");
 		outn ("#define YY_SKIP_YYWRAP");
 	}
 
Index: scan.c
--- scan.c.orig	2006-02-21 03:45:51 +0100
+++ scan.c	2006-02-23 15:41:40 +0100
@@ -2649,7 +2649,7 @@
 case 77:
 YY_RULE_SETUP
 #line 354 "scan.l"
-ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+ACTION_M4_IFDEF("M4""_YY_NO_UNISTD_H", ! option_sense);
 	YY_BREAK
 case 78:
 YY_RULE_SETUP
Index: scan.l
--- scan.l.orig	2006-02-14 20:28:53 +0100
+++ scan.l	2006-02-23 15:27:46 +0100
@@ -351,7 +351,7 @@
 	stack		ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
 	stdinit		do_stdinit = option_sense;
 	stdout		use_stdout = option_sense;
-    unistd      ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+    unistd      ACTION_M4_IFDEF("M4""_YY_NO_UNISTD_H", ! option_sense);
 	unput		ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
 	verbose		printstats = option_sense;
 	warn		nowarn = ! option_sense;
Index: skel.c
--- skel.c.orig	2006-02-21 03:45:41 +0100
+++ skel.c	2006-02-23 15:43:40 +0100
@@ -983,6 +983,18 @@
   "void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );",
   "]])",
   "",
+  "m4_ifdef( [[M4_YY_REENTRANT]],",
+  "[[",
+  "m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,",
+  "[[",
+  "int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+  "]])",
+  "m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,",
+  "[[",
+  "void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );",
+  "]])",
+  "]])",
+  "",
   "%if-bison-bridge",
   "m4_ifdef( [[M4_YY_NO_GET_LVAL]],,",
   "[[",
@@ -1351,9 +1363,9 @@
   "    m4_dnl  The bison pure parser is used. Redefine yylex to",
   "    m4_dnl  accept the lval parameter.",
   "",
-  "    m4_define( [[M4_YY_LEX_PROTO]],",
+  "    m4_define( [[M4_YY_LEX_PROTO]], [[\\]]",
   "               [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])",
-  "    m4_define( [[M4_YY_LEX_DECLARATION]],",
+  "    m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]",
   "               [[YYFARGS1(YYSTYPE *,yylval_param)]])",
   "]])",
   "",
@@ -1361,9 +1373,9 @@
   "[[",
   "    m4_dnl  Locations are used. yylex should also accept the ylloc parameter.",
   "",
-  "    m4_define( [[M4_YY_LEX_PROTO]],",
+  "    m4_define( [[M4_YY_LEX_PROTO]], [[\\]]",
   "               [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])",
-  "    m4_define( [[M4_YY_LEX_DECLARATION]],",
+  "    m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]",
   "               [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])",
   "]])",
   "",
Index: tables.c
--- tables.c.orig	2002-11-27 15:43:24 +0100
+++ tables.c	2006-02-23 15:27:48 +0100
@@ -86,7 +86,7 @@
 	th->th_magic = YYTBL_MAGIC;
 	th->th_hsize = 14 + strlen (version_str) + 1 + strlen (name) + 1;
 	th->th_hsize += yypad64 (th->th_hsize);
-	th->th_ssize = 0;	// Not known at this point.
+	th->th_ssize = 0;
 	th->th_flags = 0;
 	th->th_version = copy_string (version_str);
 	th->th_name = copy_string (name);
