Add i18n support to the GLR skeleton. Partially fix the C++

skeleton; a C++ expert needs to finish this.  Remove debugging
msgids; there's little point to having them translated, since they
can be understood only by someone who can read the
(English-language) source code.

Generate runtime-po/bison-runtime.pot automatically, so that we
don't have to worry about garbage getting in that file.  We'll
make sure after the next official release that old msgids don't
get lost.  See
<http://lists.gnu.org/archive/html/bison-patches/2005-07/msg00119.html>.

* runtime-po/Makefile.in.in, runtime-po/bison-runtime.pot: Remove.
Now auto-generated.
* PACKAGING: Don't claim that Gawk, GCC, Perl use this method yet.
Fix typos in explanations of the runtime file.
* bootstrap: Change gettext keyword from YYI18N to YY_.
Use standard Makefile.in.in in runtime-po, since we'll arrange
for backward-compatible bison-runtime.po files in a different way.
* data/glr.c (YY_): New macro, from yacc.c.
(yyuserAction, yyreportAmbiguity, yyreportSyntaxError, yyparse):
Translate messages intended for users.
(yyreportSyntaxError): Change "virtual memory" to "memory" to match
the wording in the other skeletons.  We don't know that the memory
is virtual.
* data/lalr1.cc (YY_): Renamed from _.  All uses changed.
Use same method that yacc.c uses.
Don't translate debugging messages.
(yy::yyreport_syntax_error): Put in a FIXME for the i18n stuff;
it doesn't work (yet), and requires C++ expertise to fix.
* data/yacc.c (YY_): Renamed from YY18N.  All uses changed.
Move defn to a more logical place, to be consistent with other
skeletons.
Don't translate debugging messages.
Don't assume line numbers fit in unsigned int; use unsigned long fmts.
* doc/bison.texinfo: Mention <libintl.h>.  Change glibc cross reference
to gettext cross reference.  Add indexing terms.  Mention YYENABLE_NLS.
* runtime-po/POTFILES.in: Add data/glr.c, data/lalr1.cc.
This commit is contained in:
Paul Eggert
2005-07-18 22:10:15 +00:00
parent ac8c5689f8
commit 30757c8c93
11 changed files with 153 additions and 538 deletions

View File

@@ -218,6 +218,18 @@ b4_syncline([@oline@], [@ofile@])
#include <stdarg.h>
#include <setjmp.h>
#ifndef YY_
# if YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
# endif
# endif
# ifndef YY_
# define YY_(msgid) msgid
# endif
#endif
#ifndef YYFREE
# define YYFREE free
#endif
@@ -771,7 +783,7 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
# define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal)
# undef YYBACKUP
# define YYBACKUP(Token, Value) \
return yyerror (]b4_yyerror_args["syntax error: cannot back up"), \
return yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")), \
yyerrok, yyerr
yylow = 1;
@@ -1524,7 +1536,7 @@ yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1,
yyreportTree (yyx1, 2);
YYFPRINTF (stderr, "\n");
#endif
yyFail (yystack][]b4_pure_args[, "ambiguity detected");
yyFail (yystack][]b4_pure_args[, YY_("ambiguity detected"));
}
@@ -1774,8 +1786,8 @@ yyreportSyntaxError (yyGLRStack* yystack,
yyprefix = yyor;
}
yyf = yyformat;
yysize1 = yysize + (yyfmt - yyformat);
yyf = YY_(yyformat);
yysize1 = yysize + strlen (yyf);
yysize_overflow |= yysize1 < yysize;
yysize = yysize1;
@@ -1803,11 +1815,11 @@ yyreportSyntaxError (yyGLRStack* yystack,
YYFREE (yymsg);
}
else
yyerror (]b4_lyyerror_args["syntax error; also virtual memory exhausted");
yyerror (]b4_lyyerror_args[YY_("syntax error; also memory exhausted"));
}
else
#endif /* YYERROR_VERBOSE */
yyerror (]b4_lyyerror_args["syntax error");
yyerror (]b4_lyyerror_args[YY_("syntax error"));
yynerrs += 1;
}
}
@@ -2068,7 +2080,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
{
yyundeleteLastStack (&yystack);
if (yystack.yytops.yysize == 0)
yyFail (&yystack][]b4_lpure_args[, "syntax error");
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[
@@ -2098,7 +2110,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
goto yyreturn;
yyoverflowlab:
yyerror (]b4_lyyerror_args["parser stack overflow");
yyerror (]b4_lyyerror_args[YY_("parser stack overflow"));
yyresult = 2;
/* Fall through. */