Alien-flex

 view release on metacpan or  search on metacpan

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

+#: 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()"
+
+#: src/misc.c:212
+#, c-format
+msgid "bad character '%s' detected in check_char()"
+msgstr "check_char() виявив недопустимий символ «%s»"
+
+#: src/misc.c:217
+#, c-format
+msgid "scanner requires -8 flag to use the character %s"

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

 
@@ -246,6 +277,16 @@
    `char[]'. */
 #undef YYTEXT_POINTER
 
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
diff --git a/src/filter.c b/src/filter.c
index 71f3635..a7e69ec 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -47,10 +47,9 @@ struct filter *filter_create_ext (struct filter *chain, const char *cmd,
 	va_list ap;
 
 	/* allocate and initialize new filter */
-	f = malloc(sizeof(struct filter));
+	f = calloc(sizeof(struct filter), 1);
 	if (!f)
-		flexerror(_("malloc failed (f) in filter_create_ext"));
-	memset (f, 0, sizeof (*f));
+		flexerror(_("calloc failed (f) in filter_create_ext"));
 	f->filter_func = NULL;
 	f->extra = NULL;
 	f->next = NULL;
@@ -100,10 +99,9 @@ struct filter *filter_create_int (struct filter *chain,
 	struct filter *f;
 
 	/* allocate and initialize new filter */
-	f = malloc(sizeof(struct filter));
+	f = calloc(sizeof(struct filter), 1);
 	if (!f)
-		flexerror(_("malloc failed in filter_create_int"));
-	memset (f, 0, sizeof (*f));
+		flexerror(_("calloc failed in filter_create_int"));
 	f->next = NULL;
 	f->argc = 0;
 	f->argv = NULL;
@@ -230,8 +228,7 @@ int filter_tee_header (struct filter *chain)
 	 * header file at the same time.
 	 */
 
-	const int readsz = 512;
-	char   *buf;
+	char    buf[512];
 	int     to_cfd = -1;
 	FILE   *to_c = NULL, *to_h = NULL;
 	bool    write_header;
@@ -283,10 +280,7 @@ int filter_tee_header (struct filter *chain)
 	fprintf (to_c, "m4_define( [[M4_YY_OUTFILE_NAME]],[[%s]])m4_dnl\n",
 		 outfilename ? outfilename : "<stdout>");
 
-	buf = malloc((size_t) readsz);
-	if (!buf)
-		flexerror(_("malloc failed in filter_tee_header"));
-	while (fgets (buf, readsz, stdin)) {
+	while (fgets (buf, sizeof buf, stdin)) {
 		fputs (buf, to_c);
 		if (write_header)
 			fputs (buf, to_h);
@@ -328,6 +322,13 @@ int filter_tee_header (struct filter *chain)
 	return 0;
 }
 
+static bool is_blank_line (const char *str)
+{
+	while (isspace(*str))
+		str++;
+	return (*str == '\0');
+}
+
 /** Adjust the line numbers in the #line directives of the generated scanner.
  * After the m4 expansion, the line numbers are incorrect since the m4 macros
  * can add or remove lines.  This only adjusts line numbers for generated code,
@@ -336,8 +337,8 @@ int filter_tee_header (struct filter *chain)
  */
 int filter_fix_linedirs (struct filter *chain)
 {
-	char   *buf;
-	const size_t readsz = 512;
+	char   buf[512];
+	const size_t readsz = sizeof buf;
 	int     lineno = 1;
 	bool    in_gen = true;	/* in generated code */
 	bool    last_was_blank = false;
@@ -345,10 +346,6 @@ int filter_fix_linedirs (struct filter *chain)
 	if (!chain)
 		return 0;
 
-	buf = malloc(readsz);
-	if (!buf)
-		flexerror(_("malloc failed in filter_fix_linedirs"));
-
 	while (fgets (buf, (int) readsz, stdin)) {
 
 		regmatch_t m[10];
@@ -391,7 +388,7 @@ int filter_fix_linedirs (struct filter *chain)
 				/* Adjust the line directives. */
 				in_gen = true;
 				snprintf (buf, readsz, "#line %d \"%s\"\n",
-					  lineno, filename);
+					  lineno + 1, filename);
 			}
 			else {
 				/* it's a #line directive for code we didn't write */
@@ -403,9 +400,7 @@ int filter_fix_linedirs (struct filter *chain)
 		}
 
 		/* squeeze blank lines from generated code */
-		else if (in_gen
-			 && regexec (&regex_blank_line, buf, 0, NULL,

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)
-		flexfatal (_
-			   ("memory allocation failed in allocate_array()"));
-
-	return mem;
+	return new_array;
 }
 
 
@@ -659,17 +662,22 @@ char   *readable_form (int c)



( run in 1.834 second using v1.01-cache-2.11-cpan-df04353d9ac )