[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improved xgettext invocation for Bison
From: |
Paul Eggert |
Subject: |
improved xgettext invocation for Bison |
Date: |
Tue, 12 Nov 2002 22:45:05 -0800 (PST) |
I checked in the following patch.
2002-11-12 Paul Eggert <address@hidden>
* Makefile.maint (po-check): Scan .l and .y files instead of the
.c and the .h files that they generate. This fixes the bug
reported by Tim Van Holder in:
<http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
Look for N_ as well as for _. Try to avoid matching #define for
N_ and _.
* po/POTFILES.in: Remove src/parse-gram.c, src/scan-gram.c,
src/system.h. Add src/parse-gram.y, src/scan-gram.l.
* src/scan-gram.l: Revamp regular expressions so that " and '
do not confuse xgettext.
Index: Makefile.maint
===================================================================
RCS file: /cvsroot/bison/bison/Makefile.maint,v
retrieving revision 1.11
diff -p -u -r1.11 Makefile.maint
--- Makefile.maint 12 Nov 2002 17:50:21 -0000 1.11
+++ Makefile.maint 13 Nov 2002 06:38:52 -0000
@@ -97,7 +97,16 @@ m4-check:
po-check:
if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in | sort > address@hidden; \
- grep -E -l '\b_\(' lib/*.[ch] src/*.[ch] | sort > address@hidden; \
+ files=; \
+ for file in lib/*.[chly] src/*.[chly]; do \
+ case $$file in \
+ *.[ch]) \
+ base=`expr " $$file" : ' \(.*\)\..'`; \
+ { test -f $$base.l || test -f $$base.y; } && continue;; \
+ esac; \
+ files="$$files $$file"; \
+ done; \
+ grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort > address@hidden; \
diff -u address@hidden address@hidden || exit 1; \
rm -f address@hidden address@hidden; \
fi
Index: po/POTFILES.in
===================================================================
RCS file: /cvsroot/bison/bison/po/POTFILES.in,v
retrieving revision 1.18
diff -p -u -r1.18 POTFILES.in
--- po/POTFILES.in 12 Nov 2002 16:09:37 -0000 1.18
+++ po/POTFILES.in 13 Nov 2002 06:38:52 -0000
@@ -4,14 +4,13 @@ src/files.c
src/getargs.c
src/gram.c
src/main.c
-src/parse-gram.c
+src/parse-gram.y
src/print.c
src/reader.c
src/reduce.c
-src/scan-gram.c
+src/scan-gram.l
src/symlist.c
src/symtab.c
-src/system.h
lib/argmatch.c
lib/bitset_stats.c
Index: src/scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.42
diff -p -u -r1.42 scan-gram.l
--- src/scan-gram.l 12 Nov 2002 08:26:38 -0000 1.42
+++ src/scan-gram.l 13 Nov 2002 06:38:53 -0000
@@ -259,7 +259,10 @@ splice (\\[ \f\t\v]*\n)*
YY_STEP;
}
- ^"#line "{int}" \""[^\"]*"\"\n" handle_syncline (yytext + strlen ("#line
"), yylloc); YY_STEP;
+ ^"#line "{int}" \"".*"\"\n" {
+ handle_syncline (yytext + sizeof "#line " - 1, yylloc);
+ YY_STEP;
+ }
"=" return EQUAL;
":" rule_length = 0; return COLON;
@@ -450,7 +453,10 @@ splice (\\[ \f\t\v]*\n)*
\\r obstack_1grow (&string_obstack, '\r');
\\t obstack_1grow (&string_obstack, '\t');
\\v obstack_1grow (&string_obstack, '\v');
- \\[\"\'?\\] obstack_1grow (&string_obstack, yytext[1]);
+
+ /* \\[\"\'?\\] would be shorter, but it confuses xgettext. */
+ \\("\""|"'"|"?"|"\\") obstack_1grow (&string_obstack, yytext[1]);
+
\\(u|U[0-9a-fA-F]{4})[0-9a-fA-F]{4} {
int c = convert_ucn_to_byte (yytext);
if (c < 0)
@@ -477,9 +483,9 @@ splice (\\[ \f\t\v]*\n)*
<SC_CHARACTER>
{
- "'" YY_OBS_GROW; BEGIN c_context;
- \\{splice}[\'\\] YY_OBS_GROW;
- <<EOF>> unexpected_end_of_file (yylloc, "'");
+ "'" YY_OBS_GROW; BEGIN c_context;
+ address@hidden YY_OBS_GROW;
+ <<EOF>> unexpected_end_of_file (yylloc, "'");
}
@@ -490,9 +496,9 @@ splice (\\[ \f\t\v]*\n)*
<SC_STRING>
{
- "\"" YY_OBS_GROW; BEGIN c_context;
- \\{splice}[\"\\] YY_OBS_GROW;
- <<EOF>> unexpected_end_of_file (yylloc, "\"");
+ "\"" YY_OBS_GROW; BEGIN c_context;
+ address@hidden YY_OBS_GROW;
+ <<EOF>> unexpected_end_of_file (yylloc, "\"");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- improved xgettext invocation for Bison,
Paul Eggert <=