1 diff -urN -X ./diff-exclude flex-2.5.31/flex.skl flex/flex.skl
2 --- flex-2.5.31/flex.skl 2003-04-01 04:51:38.000000000 +0300
3 +++ flex/flex.skl 2004-01-02 12:22:33.000000000 +0200
5 %# Macros for runtime processing stage.
9 +%# Support for m4 quote escaping
11 +m4_define( {m4_userquote_start}, {m4_changequote(<, >)[[m4_changequote([[, ]])})
12 +m4_define( {m4_userquote_end}, {m4_changequote(<, >)]]m4_changequote([[, ]])})
15 m4_changequote([[, ]])
18 diff -urN -X ./diff-exclude flex-2.5.31/flexdef.h flex/flexdef.h
19 --- flex-2.5.31/flexdef.h 2003-04-01 04:51:38.000000000 +0300
20 +++ flex/flexdef.h 2004-01-02 12:14:49.000000000 +0200
22 * yymore_really_used - whether to treat yymore() as really used, regardless
23 * of what we think based on references to it in the user's actions.
24 * reject_really_used - same for REJECT
25 + * keep_m4 - dont quote m4 quotes "[[", "]]" - so user can use m4
28 extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn,
30 extern int yymore_used, reject, real_reject, continued_action, in_rule;
32 extern int yymore_really_used, reject_really_used;
36 /* Variables used in the flex input routines:
37 * datapos - characters on current output line
38 diff -urN -X ./diff-exclude flex-2.5.31/main.c flex/main.c
39 --- flex-2.5.31/main.c 2003-04-01 04:51:38.000000000 +0300
40 +++ flex/main.c 2004-01-02 12:13:07.000000000 +0200
42 bool *rule_has_nl, *ccl_has_nl;
44 bool ansi_func_defs, ansi_func_protos;
47 bool tablesext, tablesverify, gentables;
48 char *tablesfilename=0,*tablesname=0;
60 diff -urN -X ./diff-exclude flex-2.5.31/options.c flex/options.c
61 --- flex-2.5.31/options.c 2003-03-25 18:39:08.000000000 +0200
62 +++ flex/options.c 2004-01-02 12:16:07.000000000 +0200
64 /* The command-line options, passed to scanopt_init() */
65 optspec_t flexopts[] = {
67 + {"-4", OPT_KEEP_M4, 0}
69 + {"--keep-m4", OPT_KEEP_M4, 0}
70 + , /* dont try to quote m4 */
73 {"--7bit", OPT_7BIT, 0}
74 diff -urN -X ./diff-exclude flex-2.5.31/options.h flex/options.h
75 --- flex-2.5.31/options.h 2003-03-25 18:39:08.000000000 +0200
76 +++ flex/options.h 2004-01-02 12:15:30.000000000 +0200
85 diff -urN -X ./diff-exclude flex-2.5.31/scan.l flex/scan.l
86 --- flex-2.5.31/scan.l 2003-04-01 04:51:38.000000000 +0300
87 +++ flex/scan.l 2004-01-02 12:00:21.000000000 +0200
89 if ( getenv("POSIXLY_CORRECT") ) \
92 +/* Macros need to be clearly separated from surrounding text
93 + and this file needs to go through (unpatched) flex untouched. */
94 +static char *userquote_start = "[" "[]" "]m4_" "userquote_start()";
95 +static char *userquote_end = "[" "[]" "]m4_" "userquote_end()";
97 +#define QUOTE4_START \
102 + add_action(userquote_start); \
106 +#define QUOTE4_END \
111 + add_action(userquote_end); \
117 %option caseless nodefault stack noyy_top_state
120 %x SECT2 SECT2PROLOG SECT3 CODEBLOCK PICKUPDEF SC CARETISBOL NUM QUOTE
121 %x FIRSTCCL CCL ACTION RECOVER COMMENT ACTION_STRING PERCENT_BRACE_ACTION
122 -%x OPTION LINEDIR CODEBLOCK_MATCH_BRACE
123 +%x OPTION LINEDIR CODEBLOCK_MATCH_BRACE PROLOGLINE
129 "*/" ACTION_ECHO; yy_pop_state();
131 - [^*\n]+ ACTION_ECHO;
132 - [^*\n]*{NL} ++linenum; ACTION_ECHO;
133 + [\[\]] ACTION_ECHO;
134 + [^*\[\]\n]+ ACTION_ECHO;
135 + [^*\[\]\n]*{NL} ++linenum; ACTION_ECHO;
143 ^"%}".*{NL} ++linenum; BEGIN(INITIAL);
145 - {NAME}|{NOT_NAME}|. ACTION_ECHO;
149 + [^\n\]\[]+ ACTION_ECHO;
150 + [\]\[] ACTION_ECHO;
154 @@ -242,10 +272,25 @@
155 buf_strnappend(&top_buf, yytext, yyleng);
160 buf_strnappend(&top_buf, yytext, yyleng);
163 + [\]\[] buf_strnappend(&top_buf, yytext, yyleng);
167 + buf_strnappend(&top_buf, yytext, yyleng);
169 + buf_strappend(&top_buf, userquote_start);
173 + buf_strnappend(&top_buf, yytext, yyleng);
175 + buf_strappend(&top_buf, userquote_end);
179 linenum = brace_start_line;
180 synerr(_("Unmatched '{'"));
181 @@ -424,33 +469,48 @@
185 - ^"%{".* ++bracelevel; yyless( 2 ); /* eat only %{ */
186 - ^"%}".* --bracelevel; yyless( 2 ); /* eat only %} */
188 - ^{WS}.* ACTION_ECHO; /* indented code in prolog */
189 + ^"%{".* ++bracelevel; yyless( 2 ); /* eat only %{ */
190 + ^"%}".* --bracelevel; yyless( 2 ); /* eat only %} */
192 + ^{WS}.* { /* indented code in prolog */
196 ^{NOT_WS}.* { /* non-indented code */
197 + yyless( 0 ); /* put it all back */
198 if ( bracelevel <= 0 )
199 { /* not in %{ ... %} */
200 - yyless( 0 ); /* put it all back */
211 - {NL} ++linenum; ACTION_ECHO;
212 + .* yyless(0); BEGIN(PROLOGLINE);
217 - yyterminate(); /* to stop the parser */
218 + {NL} ++linenum; ACTION_ECHO;
222 + [^\]\[\n\r]* ACTION_ECHO;
225 + [\]\[] ACTION_ECHO;
229 + BEGIN(SECT2PROLOG);
233 +<PROLOGLINE,SECT2PROLOG><<EOF>> {
240 ^{OPTWS}{NL} ++linenum; /* allow blank lines in section 2 */
242 @@ -768,10 +828,15 @@
244 "{" ACTION_ECHO; ++bracelevel;
245 "}" ACTION_ECHO; --bracelevel;
246 - [^[:alpha:]_{}"'/\n]+ ACTION_ECHO;
247 + [^[:alpha:]_{}\[\]"'/\n]+ ACTION_ECHO;
249 "'"([^'\\\n]|\\.)*"'" ACTION_ECHO; /* character constant */
250 \" ACTION_ECHO; BEGIN(ACTION_STRING);
254 + [\]\[] ACTION_ECHO;
263 - [^"\\\n]+ ACTION_ECHO;
264 + [^"\]\[\\\n]+ ACTION_ECHO;
267 + [\]\[] ACTION_ECHO;
269 {NL} ++linenum; ACTION_ECHO; BEGIN(ACTION);
270 \" ACTION_ECHO; BEGIN(ACTION);
276 + [^\]\[\n\r]*({NL})? ECHO;
278 + \[\[ if (keep_m4) {
281 + fputs(userquote_start, yyout);
283 + \]\] if (keep_m4) {
286 + fputs(userquote_end, yyout);
291 <<EOF>> sectnum = 0; yyterminate();
294 diff -urN -X ./diff-exclude flex-2.5.31/tests/Makefile.am flex/tests/Makefile.am
295 --- flex-2.5.31/tests/Makefile.am 2003-03-27 20:02:59.000000000 +0200
296 +++ flex/tests/Makefile.am 2004-01-02 11:48:17.000000000 +0200
299 test-posixly-correct \
307 test-posixly-correct \
313 diff -urN -X ./diff-exclude flex-2.5.31/tests/test-m4-quotes/Makefile.am flex/tests/test-m4-quotes/Makefile.am
314 --- flex-2.5.31/tests/test-m4-quotes/Makefile.am 1970-01-01 03:00:00.000000000 +0300
315 +++ flex/tests/test-m4-quotes/Makefile.am 2004-01-02 11:49:06.000000000 +0200
317 +# This file is part of flex.
319 +# Redistribution and use in source and binary forms, with or without
320 +# modification, are permitted provided that the following conditions
323 +# 1. Redistributions of source code must retain the above copyright
324 +# notice, this list of conditions and the following disclaimer.
325 +# 2. Redistributions in binary form must reproduce the above copyright
326 +# notice, this list of conditions and the following disclaimer in the
327 +# documentation and/or other materials provided with the distribution.
329 +# Neither the name of the University nor the names of its contributors
330 +# may be used to endorse or promote products derived from this software
331 +# without specific prior written permission.
333 +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
334 +# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
335 +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
338 +FLEX = $(top_builddir)/flex
340 +builddir = @builddir@
342 +EXTRA_DIST = scanner.l test.input
343 +CLEANFILES = scanner.c scanner.h TEMPLATE OUTPUT $(OBJS)
346 +AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_srcdir) -I$(top_builddir)
350 +scanner.c: $(srcdir)/scanner.l
351 + $(FLEX) $(LFLAGS) $<
353 +$(testname)$(EXEEXT): $(OBJS)
354 + $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
356 +test: $(testname)$(EXEEXT)
357 + ./$(testname)$(EXEEXT) < $(srcdir)/test.input
360 + $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
361 diff -urN -X ./diff-exclude flex-2.5.31/tests/test-m4-quotes/scanner.l flex/tests/test-m4-quotes/scanner.l
362 --- flex-2.5.31/tests/test-m4-quotes/scanner.l 1970-01-01 03:00:00.000000000 +0300
363 +++ flex/tests/test-m4-quotes/scanner.l 2004-01-02 11:49:33.000000000 +0200
366 + * This file is part of flex.
368 + * Redistribution and use in source and binary forms, with or without
369 + * modification, are permitted provided that the following conditions
372 + * 1. Redistributions of source code must retain the above copyright
373 + * notice, this list of conditions and the following disclaimer.
374 + * 2. Redistributions in binary form must reproduce the above copyright
375 + * notice, this list of conditions and the following disclaimer in the
376 + * documentation and/or other materials provided with the distribution.
378 + * Neither the name of the University nor the names of its contributors
379 + * may be used to endorse or promote products derived from this software
380 + * without specific prior written permission.
382 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
383 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
384 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
388 +/* [[ grep qtest scanner.c ]] */
400 +static char *p = "]]"; /* qtest */
402 +#define fx1(x) a[b[0]] /* qtest */
404 +static void xerror(char *msg);
408 +%option 8bit outfile="scanner.c" prefix="test"
409 +%option nounput nomain noyywrap
412 +/* qtest: ]] [[ ]] */
418 + if (a[a[0]]) ; /* qtest */
419 + p = "[["; /* qtest */
421 + if (a[a[0]]) ; /* qtest */
422 + p = "[["; /* qtest */
425 +a if (a[a[0]]) ; /* qtest */
427 + if (a[a[0]]) ; /* qtest */
428 + p = "[["; /* qtest */
430 +c /* qtest: ]] [[ ]] */
431 + /* qtest: ]] [[ ]] */
432 +d if (strlen(p) != 2) xerror("qtest [[ ]]\n");
433 +e if (strcmp(p, "[[")) xerror("qtest\n");
438 +/* qtest: ]] [[ ]] */
442 +static void xerror(char *msg)
444 + fprintf(stderr, "error: %s\n", msg);
454 + if (a[a[0]]) ; /* qtest */
455 + printf("TEST RETURNING OK.\n");
458 diff -urN -X ./diff-exclude flex-2.5.31/tests/test-m4-quotes/test.input flex/tests/test-m4-quotes/test.input
459 --- flex-2.5.31/tests/test-m4-quotes/test.input 1970-01-01 03:00:00.000000000 +0300
460 +++ flex/tests/test-m4-quotes/test.input 2004-01-02 11:49:49.000000000 +0200
469 diff -urN -X ./diff-exclude flex-2.5.31/tests/test-reject/Makefile.am flex/tests/test-reject/Makefile.am
470 --- flex-2.5.31/tests/test-reject/Makefile.am 2002-10-11 18:26:43.000000000 +0300
471 +++ flex/tests/test-reject/Makefile.am 2003-12-28 04:56:02.000000000 +0200
476 -FLEX = $(top_builddir)/flex
477 +FLEX = $(top_builddir)/flex -4
479 EXTRA_DIST = scanner.l test.input
480 CLEANFILES = scanner.c test-reject-* OUTPUT $(OBJS)
481 diff -urN -X ./diff-exclude flex-2.5.31/tests/test-table-opts/Makefile.am flex/tests/test-table-opts/Makefile.am
482 --- flex-2.5.31/tests/test-table-opts/Makefile.am 2002-10-11 18:26:43.000000000 +0300
483 +++ flex/tests/test-table-opts/Makefile.am 2003-12-28 04:54:00.000000000 +0200
485 # ------------------------------------------------
488 -FLEX = $(top_builddir)/flex
489 +FLEX = $(top_builddir)/flex -4
491 testname := test-table-opts
492 allopts := -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem
493 --- flex-2.5.31/configure.in.orig 2004-07-19 21:19:47.640163000 +0000
494 +++ flex-2.5.31/configure.in 2004-07-19 21:37:45.584485799 +0000
496 tests/test-include-by-buffer/Makefile
497 tests/test-include-by-push/Makefile
498 tests/test-include-by-reentrant/Makefile
499 +tests/test-m4-quotes/Makefile
500 tests/test-multiple-scanners-nr/Makefile
501 tests/test-multiple-scanners-r/Makefile
502 tests/test-noansi-nr/Makefile