Alien-flex

 view release on metacpan or  search on metacpan

patch/flex-2.6.4.diff  view on Meta::CPAN

+	$(MAKE) $(AM_MAKEFLAGS) lib_LTLIBRARIES=libfl.la clean-libLTLIBRARIES \
+	clean-libtool
+
 # Create the ChangeLog, but only if we're inside a git working directory
 
 ChangeLog: $(srcdir)/tools/git2cl
@@ -968,7 +991,8 @@ install-exec-hook:
 	cd $(DESTDIR)$(bindir) && \
 		$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
 
-.PHONY: ChangeLog indent
+.PHONY: libfl install-libfl uninstall-libfl clean-libfl \
+	ChangeLog indent
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/NEWS b/NEWS
index 85d900b..2a8c897 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,59 @@
 flex NEWS
 
+* Noteworthy changes in release  ?.? (????-??-??) [?]
+
+** build
+
+*** Flex now includes its own <config.h> header before including
+    system headers so that any system specific features detected by
+    configure are taken into account during compilation of flex
+    itself.
+
+*** The flex build system now includes Makefile targets at the top
+    level to allow just building and installing libfl.
+
+*** The flex distribution now includes a file, src/libfl.pc, to allow
+    using pkgconfig to find out what flags to use when building
+    against libfl from flex.
+
+*** Various edge cases, mostly involving out-of-tree builds have been
+    accounted for in the autotools build system.
+
+*** A crash during building on NetBSD has been fixed.
+
+*** Flex is now automatically built by travis-ci. That should increase
+    the visibility of bugs and help prevent regressions.
+
+** documentation
+
+*** a new Ukrainian translation has been submitted from the Translation Project.
+
+** scanner
+
+*** Some memory leaks have been fixed.
+
+*** A long standing bug that effected expressions of the form c{i,j}
+    where 'c' is a character and {i,j} describes the number of times
+    to match against 'c' when case sensitivity was turned on has been
+    fixed.
+
+*** New option: --backup-file allows setting the name of the file
+    written containing backing up information. Useful if you need
+    backing up information from multiple scanners in the same
+    directory.
+
+*** flex emits correct line number directives when line numbers refer
+    to the file containing the line number directives.
+
+*** The options {no,}yy{get,set}_column are now supported.
+
+** test
+
+*** Generating the various tableoptions make rules is now more portable.
+
+*** Tests of the options -C*f and -C*F will now run correctly on
+    filesystems that are not case sensitive.
+
 * Noteworthy changes in release 2.6.4 (2017-05-06) [stable]
 
 ** build
diff --git a/README.md b/README.md
index b979b01..b388c07 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ interest:
 * COPYING - flex's copyright and license.
 * doc/ - user documentation.
 * examples/ - containing examples of some possible flex scanners and a
-	      few other things. See the file examples/README for more
+              few other things. See the file examples/README for more
               details.
 * tests/ - regression tests. See TESTS/README for details.
 * po/ - internationalization support files.
@@ -43,7 +43,7 @@ repository:
 
 * compiler suite - flex is built with gcc
 * bash, or a good Bourne-style shell
-* m4 - m4 -p needs to work; GNU m4 and a few others are suitable
+* m4 - `m4 -P` needs to work; GNU m4 and a few others are suitable
 * GNU bison;  to generate parse.c from parse.y
 * autoconf; for handling the build system
 * automake; for Makefile generation
@@ -74,12 +74,14 @@ in the top level of the flex source tree.
 This script calls the various tools needed to get flex ready for the
 GNU-style configure script to be able to work.
 
-From this point on, building flex follows the usual  routine:
+From this point on, building flex follows the usual routine:
 
 ```bash
 configure && make && make install
 ```
 
+---
+
 This file is part of flex.
 
 This code is derived from software contributed to Berkeley by
diff --git a/aclocal.m4 b/aclocal.m4
index 1b6f735..17e4943 100644
--- a/aclocal.m4

patch/flex-2.6.4.diff  view on Meta::CPAN

+#: src/main.c:435
+#, c-format
+msgid "can't open skeleton file %s"
+msgstr "Неможливо відкрити файл-каркас %s"
+
+#: src/main.c:450
+msgid "Prefix cannot include '[' or ']'"
+msgstr "Префікс не може містити «[» або «]»"
+
+#: src/main.c:474
+msgid "allocation of macro definition failed"
+msgstr "Не вдалось розмістити визначення макросу"
+
+#: src/main.c:521
+#, c-format
+msgid "input error reading skeleton file %s"
+msgstr "помилка читання файла-каркаса %s"
+
+#: src/main.c:525
+#, c-format
+msgid "error closing skeleton file %s"
+msgstr "помилка при закритті файла-каркаса %s"
+
+#: src/main.c:711
+#, c-format
+msgid "error creating header file %s"
+msgstr "помилка створення файла-заголовку %s"
+
+#: src/main.c:719
+#, c-format
+msgid "error writing output file %s"
+msgstr "помилка запису у вихідний файл %s"
+
+#: src/main.c:723
+#, c-format
+msgid "error closing output file %s"
+msgstr "помилка закриття вихідного файла %s"
+
+#: src/main.c:727
+#, c-format
+msgid "error deleting output file %s"
+msgstr "помилка видалення вихідного файла %s"
+
+#: src/main.c:734
+#, c-format
+msgid "No backing up.\n"
+msgstr "Резервне копіювання вимкнено.\n"
+
+#: src/main.c:738
+#, c-format
+msgid "%d backing up (non-accepting) states.\n"
+msgstr "резервне копіювання %d (недопустимих) станів.\n"
+
+#: src/main.c:742
+#, c-format
+msgid "Compressed tables always back up.\n"
+msgstr "Створення резервних копій стислих таблиць виконується завжди.\n"
+
+#: src/main.c:745
+#, c-format
+msgid "error writing backup file %s"
+msgstr "помилка запису резервної копії файла %s"
+
+#: src/main.c:749
+#, c-format
+msgid "error closing backup file %s"
+msgstr "помилка закриття резервної копії файла %s"
+
+#: src/main.c:754
+#, c-format
+msgid "%s version %s usage statistics:\n"
+msgstr "статистика використання %s версії %s:\n"
+
+#: src/main.c:757
+#, c-format
+msgid "  scanner options: -"
+msgstr "  параметри сканера: -"
+
+#: src/main.c:836
+#, c-format
+msgid "  %d/%d NFA states\n"
+msgstr "  %d/%d станів НСА\n"
+
+#: src/main.c:838
+#, c-format
+msgid "  %d/%d DFA states (%d words)\n"
+msgstr "  %d/%d станів ДСА (%d слів)\n"
+
+#: src/main.c:840
+#, c-format
+msgid "  %d rules\n"
+msgstr "  %d правил\n"
+
+#: src/main.c:845
+#, c-format
+msgid "  No backing up\n"
+msgstr " Резервне копіювання вимкнено\n"
+
+#: src/main.c:849
+#, c-format
+msgid "  %d backing-up (non-accepting) states\n"
+msgstr " резервне копіювання %d (недопустимих) станів\n"
+
+#: src/main.c:854
+#, c-format
+msgid "  Compressed tables always back-up\n"
+msgstr " Створення резервних копій стислих таблиць виконується завжди\n"
+
+#: src/main.c:858
+#, c-format
+msgid "  Beginning-of-line patterns used\n"
+msgstr " Використовуються шаблони початку рядка\n"
+
+#: src/main.c:860
+#, c-format
+msgid "  %d/%d start conditions\n"
+msgstr "  %d/%d початкових умов\n"
+
+#: src/main.c:864
+#, c-format
+msgid "  %d epsilon states, %d double epsilon states\n"
+msgstr "  %d епсилон-станів, %d подвійних епсилон-станів\n"
+
+#: src/main.c:868
+#, c-format
+msgid "  no character classes\n"

patch/flex-2.6.4.diff  view on Meta::CPAN

+#: src/main.c:1560
+#, c-format
+msgid "yymore() entails a minor performance penalty\n"
+msgstr "yymore() спричиняе незначне зниження продуктивності\n"
+
+#: src/main.c:1566
+#, c-format
+msgid "REJECT entails a large performance penalty\n"
+msgstr "REJECT спричиняе значне зниження продуктивності\n"
+
+#: src/main.c:1571
+#, c-format
+msgid "Variable trailing context rules entail a large performance penalty\n"
+msgstr ""
+"Правила котрі мають замикаючий контекст змінної довжини значно знижують "
+"продуктивність\n"
+
+#: src/main.c:1583
+msgid "REJECT cannot be used with -f or -F"
+msgstr "REJECT не може бути використано разом з -f або -F"
+
+#: src/main.c:1586
+#, c-format
+msgid "%option yylineno cannot be used with REJECT"
+msgstr "%option yylineno не може бути використано з REJECT"
+
+#: src/main.c:1589
+msgid "variable trailing context rules cannot be used with -f or -F"
+msgstr ""
+"Правила котрі мають замикаючий контекст змінної довжини не можуть бути "
+"використані з -f or -F"
+
+#: src/main.c:1714
+#, c-format
+msgid "%option yyclass only meaningful for C++ scanners"
+msgstr "%option yyclass має сенс тільки для сканерів C++"
+
+#: src/main.c:1801
+#, c-format
+msgid "Usage: %s [OPTIONS] [FILE]...\n"
+msgstr "Використання: %s [ПАРАМЕТРИ] [ФАЙЛ]…\n"
+
+#: src/main.c:1804
+#, fuzzy, c-format
+msgid ""
+"Generates programs that perform pattern-matching on text.\n"
+"\n"
+"Table Compression:\n"
+"  -Ca, --align      trade off larger tables for better memory alignment\n"
+"  -Ce, --ecs        construct equivalence classes\n"
+"  -Cf               do not compress tables; use -f representation\n"
+"  -CF               do not compress tables; use -F representation\n"
+"  -Cm, --meta-ecs   construct meta-equivalence classes\n"
+"  -Cr, --read       use read() instead of stdio for scanner input\n"
+"  -f, --full        generate fast, large scanner. Same as -Cfr\n"
+"  -F, --fast        use alternate table representation. Same as -CFr\n"
+"  -Cem              default compression (same as --ecs --meta-ecs)\n"
+"\n"
+"Debugging:\n"
+"  -d, --debug             enable debug mode in scanner\n"
+"  -b, --backup            write backing-up information to %s\n"
+"  -p, --perf-report       write performance report to stderr\n"
+"  -s, --nodefault         suppress default rule to ECHO unmatched text\n"
+"  -T, --trace             %s should run in trace mode\n"
+"  -w, --nowarn            do not generate warnings\n"
+"  -v, --verbose           write summary of scanner statistics to stdout\n"
+"      --hex               use hexadecimal numbers instead of octal in debug "
+"outputs\n"
+"\n"
+"Files:\n"
+"  -o, --outfile=FILE      specify output filename\n"
+"  -S, --skel=FILE         specify skeleton file\n"
+"  -t, --stdout            write scanner on stdout instead of %s\n"
+"      --yyclass=NAME      name of C++ class\n"
+"      --header-file=FILE   create a C header file in addition to the "
+"scanner\n"
+"      --tables-file[=FILE] write tables to FILE\n"
+"\n"
+"Scanner behavior:\n"
+"  -7, --7bit              generate 7-bit scanner\n"
+"  -8, --8bit              generate 8-bit scanner\n"
+"  -B, --batch             generate batch scanner (opposite of -I)\n"
+"  -i, --case-insensitive  ignore case in patterns\n"
+"  -l, --lex-compat        maximal compatibility with original lex\n"
+"  -X, --posix-compat      maximal compatibility with POSIX lex\n"
+"  -I, --interactive       generate interactive scanner (opposite of -B)\n"
+"      --yylineno          track line count in yylineno\n"
+"\n"
+"Generated code:\n"
+"  -+,  --c++               generate C++ scanner class\n"
+"  -Dmacro[=defn]           #define macro defn  (default defn is '1')\n"
+"  -L,  --noline            suppress #line directives in scanner\n"
+"  -P,  --prefix=STRING     use STRING as prefix instead of \"yy\"\n"
+"  -R,  --reentrant         generate a reentrant C scanner\n"
+"       --bison-bridge      scanner for bison pure parser.\n"
+"       --bison-locations   include yylloc support.\n"
+"       --stdinit           initialize yyin/yyout to stdin/stdout\n"
+"       --nounistd          do not include <unistd.h>\n"
+"       --noFUNCTION        do not generate a particular FUNCTION\n"
+"\n"
+"Miscellaneous:\n"
+"  -c                      do-nothing POSIX option\n"
+"  -n                      do-nothing POSIX option\n"
+"  -?\n"
+"  -h, --help              produce this help message\n"
+"  -V, --version           report %s version\n"
+msgstr ""
+"Генерує програми, що знаходять шаблони у тексті.\n"
+"\n"
+"Стиснення таблиць:\n"
+"  -Ca, --align       вирівняти таблиці у пам'яті збільшивши розмір\n"
+"                     їх елементів\n"
+"  -Ce, --ecs         створювати класи еквівалентності\n"
+"  -Cf                не стискати таблиці; використовувати -f представлення\n"
+"  -CF                не стискати таблиці; використовувати -F представлення\n"
+"  -Cm, --meta-ecs    створювати класи мета-еквівалентності\n"
+"  -Cr, --read        використати read() замість stdio як\n"
+"                     вхідні дані сканера\n"
+"  -f, --full         створити швидкий, великий сканер. Теж саме, що -Cfr\n"
+"  -F, --fast         застосувати альтернативний опис таблиць.\n"
+"                     Теж саме, що -CFr\n"
+"  -Cem               степінь стиснення за замовчуванням\n"
+"                     (теж саме, що --ecs --meta-ecs)\n"
+"\n"
+"Налагодження:\n"
+"  -d, --debug             увімкнути режим налагодження сканера\n"
+"  -b, --backup            записати резервну копію до %s\n"
+"  -p, --perf-report       записати звіт про продуктивність до stderr\n"
+"  -s, --nodefault         припинити вивід тексту (ECHO до stdout)\n"
+"                          що не збігається з жодним правилом\n"
+"  -T, --trace             %s повинен запускатися у режимі трасування\n"
+"  -w, --nowarn            не видавати попереджень\n"
+"  -v, --verbose           записати підсумкову статистику сканера до stdout\n"
+"\n"
+"Файли:\n"
+"  -o, --outfile=ФАЙЛ        вказати ім'я вихідного файла\n"
+"  -S, --skel=ФАЙЛ           вказати файл каркасу\n"
+"  -t, --stdout              записати сканер до stdout замість %s\n"
+"      --yyclass=ІМ'Я        ім'я класу C++\n"
+"      --header-file=ФАЙЛ    створити C файл заголовок сканера\n"
+"      --tables-file[=ФАЙЛ]  записати таблиці у ФАЙЛ\n"
+"\n"
+"Поведінка сканера:\n"
+"  -7, --7bit              створити 7-бітний сканер\n"
+"  -8, --8bit              створити 8-бітний сканер\n"
+"  -B, --batch             створити пакетний сканер\n"
+"                          (протилежна за властивостями до опції -I)\n"
+"  -i, --case-insensitive  ігнорувати регістр символів у шаблонах\n"
+"  -l, --lex-compat        максимальна сумісність з оригінальним lex\n"
+"  -X, --posix-compat      максимальна сумісність з POSIX lex\n"
+"  -I, --interactive       створити інтерактивний сканер\n"
+"                          (протилежна за властивостями до опції -B)\n"
+"      --yylineno          відслідковувати число рядків у yylineno\n"
+"\n"
+"Генерація коду:\n"
+"  -+,  --c++                створити C++ клас сканера\n"
+"  -Dmacro[=defn]            #define macro defn (за замовчуванням defn='1')\n"
+"  -L,  --noline             не створювати #line директиви для сканера\n"
+"  -P,  --prefix=РЯДОК       використати РЯДОК як префікс замість «yy»\n"
+"  -R,  --reentrant          генерувати реентерабельний C-сканер\n"
+"       --bison-bridge       сканер тільки для bison аналізатору\n"
+"       --bison-locations    додати підтримку yylloc\n"
+"       --stdinit            ініціалізувати yyin/yyout до stdin/stdout\n"
+"       --noansi-definitions визначення функцій у застарілому стилі\n"
+"       --noansi-prototypes  порожній список параметрів у прототипах\n"
+"       --nounistd           не додавати <unistd.h>\n"
+"       --noФУНКЦІЯ          не генерувати задану функцію ФУНКЦІЯ\n"
+"\n"
+"Інше:\n"
+"  -с                      недіючий POSIX параметр\n"
+"  -n                      недіючий POSIX параметр\n"
+"  -?\n"
+"  -h, --help              показати цю довідку\n"
+"  -V, --version           показати версію %s\n"
+
+#: src/misc.c:64
+msgid "allocation of sko_stack failed"
+msgstr "не вдалось отримати пам’ять під sko_stack"
+
+#: src/misc.c:100
+#, c-format
+msgid "name \"%s\" ridiculously long"
+msgstr "ім'я «%s» занадто довге"
+
+#: src/misc.c:149 src/misc.c:162
+msgid "memory allocation failed in allocate_array()"
+msgstr "помилка виділення пам'яті у allocate_array()"

patch/flex-2.6.4.diff  view on Meta::CPAN

 
@@ -1420,9 +1420,9 @@ void gentabs (void)
 		yytbl_data_compress (yynxt_tbl);
 		if (yytbl_data_fwrite (&tableswr, yynxt_tbl) < 0)
 			flexerror (_("Could not write yynxt_tbl"));
-		yytbl_data_destroy (yynxt_tbl);
-		yynxt_tbl = NULL;
 	}
+	yytbl_data_destroy (yynxt_tbl);
+	yynxt_tbl = NULL;
 	/* End generating yy_nxt */
 
 	/* Begin generating yy_chk */
@@ -1454,9 +1454,9 @@ void gentabs (void)
 		yytbl_data_compress (yychk_tbl);
 		if (yytbl_data_fwrite (&tableswr, yychk_tbl) < 0)
 			flexerror (_("Could not write yychk_tbl"));
-		yytbl_data_destroy (yychk_tbl);
-		yychk_tbl = NULL;
 	}
+	yytbl_data_destroy (yychk_tbl);
+	yychk_tbl = NULL;
 	/* End generating yy_chk */
 
 	free(acc_array);
diff --git a/src/gettext.h b/src/gettext.h
index ea67f30..3f62961 100644
--- a/src/gettext.h
+++ b/src/gettext.h
@@ -20,7 +20,7 @@
 #define _LIBGETTEXT_H 1
 
 /* NLS can be disabled through the configure --disable-nls option.  */
-#if ENABLE_NLS
+#ifdef ENABLE_NLS
 
 /* Get declarations of GNU message catalog functions.  */
 # include <libintl.h>
diff --git a/src/libfl.pc.in b/src/libfl.pc.in
new file mode 100644
index 0000000..8d4240c
--- /dev/null
+++ b/src/libfl.pc.in
@@ -0,0 +1,8 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+
+Name: libfl
+Description: Flex (the fast lexical analyzer) support library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lfl
diff --git a/src/main.c b/src/main.c
index e5eac44..a4047d7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -117,7 +117,7 @@ struct yytbl_writer tableswr;
 char   *program_name = "flex";
 
 static const char outfile_template[] = "lex.%s.%s";
-static const char backing_name[] = "lex.backup";
+static const char *backing_name = "lex.backup";
 static const char tablesfile_template[] = "lex.%s.tables";
 
 /* From scan.l */
@@ -197,7 +197,7 @@ int flex_main (int argc, char *argv[])
 /* Wrapper around flex_main, so flex_main can be built as a library. */
 int main (int argc, char *argv[])
 {
-#if ENABLE_NLS
+#if defined(ENABLE_NLS) && ENABLE_NLS
 #if HAVE_LOCALE_H
 	setlocale (LC_MESSAGES, "");
         setlocale (LC_CTYPE, "");
@@ -648,6 +648,7 @@ void flexend (int exit_status)
                 "yyget_extra",
                 "yyget_in",
                 "yyget_leng",
+                "yyget_column",
                 "yyget_lineno",
                 "yyget_lloc",
                 "yyget_lval",
@@ -670,6 +671,7 @@ void flexend (int exit_status)
                 "yyset_debug",
                 "yyset_extra",
                 "yyset_in",
+                "yyset_column",
                 "yyset_lineno",
                 "yyset_lloc",
                 "yyset_lval",
@@ -994,7 +996,7 @@ void flexinit (int argc, char **argv)
     flex_init_regex();
 
 	/* Enable C++ if program name ends with '+'. */
-	program_name = basename (argv[0]);
+	program_name = argv[0];
 
 	if (program_name != NULL &&
 	    program_name[strlen (program_name) - 1] == '+')
@@ -1033,6 +1035,11 @@ void flexinit (int argc, char **argv)
 			backing_up_report = true;
 			break;
 
+		case OPT_BACKUP_FILE:
+			backing_up_report = true;
+                        backing_name = arg;
+			break;
+
 		case OPT_DONOTHING:
 			break;
 
@@ -1201,7 +1208,7 @@ void flexinit (int argc, char **argv)
 			break;
 
 		case OPT_VERSION:
-			printf (_("%s %s\n"), program_name, flex_version);
+			printf ("%s %s\n", (C_plus_plus ? "flex++" : "flex"), flex_version);
 			FLEX_EXIT (0);
 
 		case OPT_WARN:
@@ -1394,6 +1401,14 @@ void flexinit (int argc, char **argv)
 			//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_COLUMN:
+			//buf_strdefine (&userdef_buf, "YY_NO_GET_COLUMN", "1");
+            buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_COLUMN",0);
+			break;
+		case OPT_NO_YYSET_COLUMN:
+			//buf_strdefine (&userdef_buf, "YY_NO_SET_COLUMN", "1");
+            buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_COLUMN",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);
@@ -1817,7 +1832,8 @@ void usage (void)
 		  "  -t, --stdout            write scanner on stdout instead of %s\n"
 		  "      --yyclass=NAME      name of C++ class\n"
 		  "      --header-file=FILE   create a C header file in addition to the scanner\n"
-		  "      --tables-file[=FILE] write tables to FILE\n" "\n"
+		  "      --tables-file[=FILE] write tables to FILE\n"
+		  "      --backup-file=FILE  write backing-up information to FILE\n" "\n"
 		  "Scanner behavior:\n"
 		  "  -7, --7bit              generate 7-bit scanner\n"
 		  "  -8, --8bit              generate 8-bit scanner\n"
@@ -1844,6 +1860,6 @@ void usage (void)
 		  "  -?\n"
 		  "  -h, --help              produce this help message\n"
 		  "  -V, --version           report %s version\n"),
-		 backing_name, program_name, outfile_path, program_name);
+		 backing_name, "flex", outfile_path, "flex");
 
 }
diff --git a/src/misc.c b/src/misc.c
index ef27833..745e6a8 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -116,15 +116,14 @@ void add_action (const char *new_text)
 	int     len = (int) strlen (new_text);
 
 	while (len + action_index >= action_size - 10 /* slop */ ) {
-		int     new_size = action_size * 2;
 
-		if (new_size <= 0)
+		if (action_size > INT_MAX / 2)
 			/* Increase just a little, to try to avoid overflow
 			 * on 16-bit machines.
 			 */
 			action_size += action_size / 8;
 		else
-			action_size = new_size;
+			action_size = action_size * 2;
 
 		action_array =
 			reallocate_character_array (action_array,
@@ -141,20 +140,24 @@ void add_action (const char *new_text)
 
 void   *allocate_array (int size, size_t element_size)
 {
-	void *mem;
-#if HAVE_REALLOCARRAY
-	/* reallocarray has built-in overflow detection */
-	mem = reallocarray(NULL, (size_t) size, element_size);
+	void *new_array;
+#if HAVE_REALLOCARR
+	new_array = NULL;
+	if (reallocarr(&new_array, (size_t) size, element_size))
+		flexfatal (_("memory allocation failed in allocate_array()"));
 #else
+# if HAVE_REALLOCARRAY
+	new_array = reallocarray(NULL, (size_t) size, element_size);
+# else
+	/* Do manual overflow detection */
 	size_t num_bytes = (size_t) size * element_size;
-	mem = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
+	new_array = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
 		malloc(num_bytes);
+# endif
+	if (!new_array)
+		flexfatal (_("memory allocation failed in allocate_array()"));
 #endif
-	if (!mem)

patch/flex-2.6.4.diff  view on Meta::CPAN

+# if HAVE_REALLOCARRAY
+	new_array = reallocarray(array, (size_t) size, element_size);
+# else
+	/* Do manual overflow detection */
 	size_t num_bytes = (size_t) size * element_size;
 	new_array = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
 		realloc(array, num_bytes);
-#endif
+# endif
 	if (!new_array)
 		flexfatal (_("attempt to increase array size failed"));
-
+#endif
 	return new_array;
 }
 
@@ -720,7 +728,10 @@ void skelout (void)
 			 */
 #define cmd_match(s) (strncmp(buf,(s),strlen(s))==0)
 
-			if (buf[1] == '%') {
+		if (buf[1] == '#') {
+                	/* %# indicates comment line to be ignored */
+            	} 
+		else if (buf[1] == '%') {
 				/* %% is a break point for skelout() */
 				return;
 			}
diff --git a/src/mkskel.sh b/src/mkskel.sh
index 1aa59e1..2d6ae9f 100755
--- a/src/mkskel.sh
+++ b/src/mkskel.sh
@@ -48,7 +48,7 @@ sed '/^%#/d
 s/m4_/m4preproc_/g
 s/a4_/4_/g
 s/[\\"]/\\&/g
-s/.*/  "&",/'
+s/[^\r]*/  "&",/'
 
 echo '  0
 };'
diff --git a/src/nfa.c b/src/nfa.c
index 9143cf6..3d9bf24 100644
--- a/src/nfa.c
+++ b/src/nfa.c
@@ -499,6 +499,8 @@ int     mkor (int first, int second)
 		}
 	}
 
+	firstst[first] = MIN(firstst[first], firstst[second]);
+
 	finalst[first] = orend;
 	return first;
 }
diff --git a/src/options.c b/src/options.c
index 366bc2e..e98159c 100644
--- a/src/options.c
+++ b/src/options.c
@@ -62,6 +62,8 @@ optspec_t flexopts[] = {
 	,
 	{"--backup", OPT_BACKUP, 0}
 	,			/* Generate backing-up information to lex.backup. */
+	{"--backup-file=FILE", OPT_BACKUP_FILE, 0}
+	,			/* Generate backing-up information to FILE. */
 	{"-B", OPT_BATCH, 0}
 	,
 	{"--batch", OPT_BATCH, 0}
@@ -255,6 +257,10 @@ optspec_t flexopts[] = {
 	,
 	{"--noyyset_lineno", OPT_NO_YYSET_LINENO, 0}
 	,
+	{"--noyyget_column", OPT_NO_YYGET_COLUMN, 0}
+	,
+	{"--noyyset_column", OPT_NO_YYSET_COLUMN, 0}
+	,
 	{"--noyyget_in", OPT_NO_YYGET_IN, 0}
 	,
 	{"--noyyset_in", OPT_NO_YYSET_IN, 0}
diff --git a/src/options.h b/src/options.h
index 5b51c23..acee275 100644
--- a/src/options.h
+++ b/src/options.h
@@ -46,6 +46,7 @@ enum flexopt_flag_t {
 	OPT_ALWAYS_INTERACTIVE,
 	OPT_ARRAY,
 	OPT_BACKUP,
+	OPT_BACKUP_FILE,
 	OPT_BATCH,
         OPT_BISON_BRIDGE,
         OPT_BISON_BRIDGE_LOCATIONS,
@@ -83,6 +84,7 @@ enum flexopt_flag_t {
 	OPT_NO_YYGET_IN,
 	OPT_NO_YYGET_LENG,
 	OPT_NO_YYGET_LINENO,
+	OPT_NO_YYGET_COLUMN,
 	OPT_NO_YYGET_LLOC,
 	OPT_NO_YYGET_LVAL,
 	OPT_NO_YYGET_OUT,
@@ -92,6 +94,7 @@ enum flexopt_flag_t {
 	OPT_NO_YYSET_EXTRA,
 	OPT_NO_YYSET_IN,
 	OPT_NO_YYSET_LINENO,
+	OPT_NO_YYSET_COLUMN,
 	OPT_NO_YYSET_LLOC,
 	OPT_NO_YYSET_LVAL,
 	OPT_NO_YYSET_OUT,
diff --git a/src/regex.c b/src/regex.c
index 38e658b..f4c4163 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -25,10 +25,8 @@
 
 
 static const char* REGEXP_LINEDIR = "^#line ([[:digit:]]+) \"(.*)\"";
-static const char* REGEXP_BLANK_LINE = "^[[:space:]]*$";
 
 regex_t regex_linedir; /**< matches line directives */
-regex_t regex_blank_line; /**< matches blank lines */
 
 
 /** Initialize the regular expressions.
@@ -37,8 +35,6 @@ regex_t regex_blank_line; /**< matches blank lines */
 bool flex_init_regex(void)



( run in 1.313 second using v1.01-cache-2.11-cpan-119454b85a5 )