mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
d: add internationalisation support
The D parser implements this feature similarly to the C parser, by using Gettext. Functions gettext() and dgettext() are imported using extern(C). The internationalisation uses yysymbol_name to report the name of the SymbolKinds. * data/skeletons/d.m4 (SymbolKind.toString.yytranslatable, SymbolKind.toString.yysymbol_name: New), data/skeletons/lalr1.d: Here. * doc/bison.texi: Document it. * tests/calc.at: Test it.
This commit is contained in:
committed by
Akim Demaille
parent
e51e89856a
commit
594cae57ca
@@ -654,6 +654,23 @@ m4_define([_AT_DATA_CALC_Y(d)],
|
||||
};
|
||||
%printer { fprintf (yyo, "%d", $$); } <ival>;
|
||||
|
||||
%code {
|
||||
]AT_TOKEN_TRANSLATE_IF([[
|
||||
static string _(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "end of input":
|
||||
return "end of file";
|
||||
case "number":
|
||||
return "nombre";
|
||||
default:
|
||||
return s;
|
||||
}
|
||||
}
|
||||
]])[
|
||||
}
|
||||
|
||||
/* Bison Declarations */
|
||||
%token EOF 0 ]AT_TOKEN_TRANSLATE_IF([_("end of file")], ["end of input"])[
|
||||
%token <ival> NUM "number"
|
||||
@@ -665,7 +682,7 @@ m4_define([_AT_DATA_CALC_Y(d)],
|
||||
STAR "*"
|
||||
SLASH "/"
|
||||
POW "^"
|
||||
EOL "\n"
|
||||
EOL "'\\n'"
|
||||
LPAR "("
|
||||
RPAR ")"
|
||||
NOT "!"
|
||||
|
||||
Reference in New Issue
Block a user