You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

267 lines
8.4 KiB

Index: doc/flex.texi
--- doc/flex.texi.orig 2007-09-10 08:16:35 +0200
+++ doc/flex.texi 2007-12-13 09:11:48 +0100
@@ -3888,6 +3888,7 @@
@example
@verbatim
// An example of using the flex C++ scanner class.
+ %option noyywrap
%{
int mylineno = 0;
@@ -3916,7 +3917,7 @@
if(c == '\n')
++mylineno;
- else if(c == @samp{*})
+ else if(c == '*')
{
if((c = yyinput()) == '/')
break;
@@ -3926,19 +3927,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 2007-09-10 08:16:34 +0200
+++ flex.skl 2007-12-13 09:17:30 +0100
@@ -957,6 +957,18 @@
int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_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 );
+]])
+]])
+
m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
[[
void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
@@ -2912,8 +2924,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 2007-09-10 08:16:34 +0200
+++ main.c 2007-12-13 09:18:51 +0100
@@ -1167,7 +1167,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;
@@ -1282,7 +1281,6 @@
break;
case OPT_STACK:
- //buf_strdefine (&userdef_buf, "YY_STACK_USED", "1");
buf_m4_define( &m4defs_buf, "M4_YY_STACK_USED",0);
break;
@@ -1339,87 +1337,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;
@@ -1572,12 +1549,11 @@
if (reject){
out_m4_define( "M4_YY_USES_REJECT", NULL);
- //outn ("\n#define YY_USES_REJECT");
}
if (!do_yywrap) {
if (!C_plus_plus) {
- 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 2007-12-12 22:05:29 +0100
+++ scan.c 2007-12-13 09:19:28 +0100
@@ -2858,7 +2858,7 @@
case 90:
YY_RULE_SETUP
#line 386 "scan.l"
-ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+ACTION_M4_IFDEF("M4""_YY_NO_UNISTD_H", ! option_sense);
YY_BREAK
case 91:
YY_RULE_SETUP
Index: scan.l
--- scan.l.orig 2007-09-10 08:16:34 +0200
+++ scan.l 2007-12-13 09:11:48 +0100
@@ -383,7 +383,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 2007-12-12 22:05:25 +0100
+++ skel.c 2007-12-13 09:23:18 +0100
@@ -1029,6 +1029,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]],,",
"[[",
@@ -3123,8 +3135,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: tables.c
--- tables.c.orig 2006-04-11 18:54:47 +0200
+++ tables.c 2007-12-13 09:11: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);