mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
Insert `_' macro around many string constants.
This commit is contained in:
56
src/reduce.c
56
src/reduce.c
@@ -138,7 +138,7 @@ reduce_grammar ()
|
||||
print_notices();
|
||||
|
||||
if (!BITISSET(N, start_symbol - ntokens))
|
||||
fatals("Start symbol %s does not derive any sentence",
|
||||
fatals(_("Start symbol %s does not derive any sentence"),
|
||||
tags[start_symbol]);
|
||||
|
||||
reduce_grammar_tables();
|
||||
@@ -151,8 +151,8 @@ reduce_grammar ()
|
||||
/**/ statisticsflag = FALSE; /* someday getopts should handle this */
|
||||
if (statisticsflag == TRUE)
|
||||
fprintf(stderr,
|
||||
"reduced %s defines %d terminal%s, %d nonterminal%s\
|
||||
, and %d production%s.\n", infile,
|
||||
_("reduced %s defines %d terminal%s, %d nonterminal%s\
|
||||
, and %d production%s.\n"), infile,
|
||||
ntokens, (ntokens == 1 ? "" : "s"),
|
||||
nvars, (nvars == 1 ? "" : "s"),
|
||||
nrules, (nrules == 1 ? "" : "s"));
|
||||
@@ -173,7 +173,7 @@ reduce_grammar ()
|
||||
* process takes only 2 seconds on my 8Mhz AT.
|
||||
*/
|
||||
|
||||
static bool
|
||||
static bool
|
||||
useful_production (i, N)
|
||||
int i;
|
||||
BSet N;
|
||||
@@ -196,7 +196,7 @@ BSet N;
|
||||
|
||||
/* Remember that rules are 1-origin, symbols are 0-origin. */
|
||||
|
||||
static void
|
||||
static void
|
||||
useless_nonterminals ()
|
||||
{
|
||||
BSet Np, Ns;
|
||||
@@ -218,7 +218,7 @@ useless_nonterminals ()
|
||||
* set being computed remains unchanged. Any nonterminals not in the
|
||||
* set at that point are useless in that they will never be used in
|
||||
* deriving a sentence of the language.
|
||||
*
|
||||
*
|
||||
* This iteration doesn't use any special traversal over the
|
||||
* productions. A set is kept of all productions for which all the
|
||||
* nonterminals in the RHS are in useful. Only productions not in
|
||||
@@ -253,7 +253,7 @@ useless_nonterminals ()
|
||||
N = Np;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
inaccessable_symbols ()
|
||||
{
|
||||
BSet Vp, Vs, Pp;
|
||||
@@ -270,13 +270,13 @@ inaccessable_symbols ()
|
||||
* reachable symbols, add the production to the set of reachable
|
||||
* productions, and add all of the nonterminals in the RHS of the
|
||||
* production to the set of reachable symbols.
|
||||
*
|
||||
*
|
||||
* Consider only the (partially) reduced grammar which has only
|
||||
* nonterminals in N and productions in P.
|
||||
*
|
||||
*
|
||||
* The result is the set P of productions in the reduced grammar, and
|
||||
* the set V of symbols in the reduced grammar.
|
||||
*
|
||||
*
|
||||
* Although this algorithm also computes the set of terminals which are
|
||||
* reachable, no terminal will be deleted from the grammar. Some
|
||||
* terminals might not be in the grammar but might be generated by
|
||||
@@ -302,7 +302,7 @@ inaccessable_symbols ()
|
||||
Vp[i] = V[i];
|
||||
for (i = 1; i <= nrules; i++)
|
||||
{
|
||||
if (!BITISSET(Pp, i) && BITISSET(P, i) &&
|
||||
if (!BITISSET(Pp, i) && BITISSET(P, i) &&
|
||||
BITISSET(V, rlhs[i]))
|
||||
{
|
||||
for (r = &ritem[rrhs[i]]; *r >= 0; r++)
|
||||
@@ -352,7 +352,7 @@ inaccessable_symbols ()
|
||||
SETBIT(V1, rprecsym[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
reduce_grammar_tables ()
|
||||
{
|
||||
/* This is turned off because we would need to change the numbers
|
||||
@@ -481,7 +481,7 @@ reduce_grammar_tables ()
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
print_results ()
|
||||
{
|
||||
int i;
|
||||
@@ -491,7 +491,7 @@ print_results ()
|
||||
|
||||
if (nuseless_nonterminals > 0)
|
||||
{
|
||||
fprintf(foutput, "Useless nonterminals:\n\n");
|
||||
fprintf(foutput, _("Useless nonterminals:\n\n"));
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
if (!BITISSET(V, i))
|
||||
fprintf(foutput, " %s\n", tags[i]);
|
||||
@@ -503,7 +503,7 @@ print_results ()
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
fprintf(foutput, "\n\nTerminals which are not used:\n\n");
|
||||
fprintf(foutput, _("\n\nTerminals which are not used:\n\n"));
|
||||
b = TRUE;
|
||||
}
|
||||
fprintf(foutput, " %s\n", tags[i]);
|
||||
@@ -512,7 +512,7 @@ print_results ()
|
||||
|
||||
if (nuseless_productions > 0)
|
||||
{
|
||||
fprintf(foutput, "\n\nUseless rules:\n\n");
|
||||
fprintf(foutput, _("\n\nUseless rules:\n\n"));
|
||||
for (i = 1; i <= nrules; i++)
|
||||
{
|
||||
if (!BITISSET(P, i))
|
||||
@@ -531,7 +531,7 @@ print_results ()
|
||||
fprintf(foutput, "\n\n");
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
dump_grammar ()
|
||||
{
|
||||
int i;
|
||||
@@ -540,23 +540,23 @@ dump_grammar ()
|
||||
fprintf(foutput,
|
||||
"ntokens = %d, nvars = %d, nsyms = %d, nrules = %d, nitems = %d\n\n",
|
||||
ntokens, nvars, nsyms, nrules, nitems);
|
||||
fprintf(foutput, "Variables\n---------\n\n");
|
||||
fprintf(foutput, "Value Sprec Sassoc Tag\n");
|
||||
fprintf(foutput, _("Variables\n---------\n\n"));
|
||||
fprintf(foutput, _("Value Sprec Sassoc Tag\n"));
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
fprintf(foutput, "%5d %5d %5d %s\n",
|
||||
i, sprec[i], sassoc[i], tags[i]);
|
||||
fprintf(foutput, "\n\n");
|
||||
fprintf(foutput, "Rules\n-----\n\n");
|
||||
fprintf(foutput, _("Rules\n-----\n\n"));
|
||||
for (i = 1; i <= nrules; i++)
|
||||
{
|
||||
fprintf(foutput, "%-5d(%5d%5d)%5d : (@%-5d)",
|
||||
fprintf(foutput, "%-5d(%5d%5d)%5d : (@%-5d)",
|
||||
i, rprec[i], rassoc[i], rlhs[i], rrhs[i]);
|
||||
for (r = &ritem[rrhs[i]]; *r > 0; r++)
|
||||
fprintf(foutput, "%5d", *r);
|
||||
fprintf(foutput, " [%d]\n", -(*r));
|
||||
}
|
||||
fprintf(foutput, "\n\n");
|
||||
fprintf(foutput, "Rules interpreted\n-----------------\n\n");
|
||||
fprintf(foutput, _("Rules interpreted\n-----------------\n\n"));
|
||||
for (i = 1; i <= nrules; i++)
|
||||
{
|
||||
fprintf(foutput, "%-5d %s :", i, tags[rlhs[i]]);
|
||||
@@ -568,28 +568,28 @@ dump_grammar ()
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
print_notices ()
|
||||
{
|
||||
extern int fixed_outfiles;
|
||||
|
||||
if (fixed_outfiles && nuseless_productions)
|
||||
fprintf(stderr, "%d rules never reduced\n", nuseless_productions);
|
||||
fprintf(stderr, _("%d rules never reduced\n"), nuseless_productions);
|
||||
|
||||
fprintf(stderr, "%s contains ", infile);
|
||||
fprintf(stderr, _("%s contains "), infile);
|
||||
|
||||
if (nuseless_nonterminals > 0)
|
||||
{
|
||||
fprintf(stderr, "%d useless nonterminal%s",
|
||||
fprintf(stderr, _("%d useless nonterminal%s"),
|
||||
nuseless_nonterminals,
|
||||
(nuseless_nonterminals == 1 ? "" : "s"));
|
||||
}
|
||||
if (nuseless_nonterminals > 0 && nuseless_productions > 0)
|
||||
fprintf(stderr, " and ");
|
||||
fprintf(stderr, _(" and "));
|
||||
|
||||
if (nuseless_productions > 0)
|
||||
{
|
||||
fprintf(stderr, "%d useless rule%s",
|
||||
fprintf(stderr, _("%d useless rule%s"),
|
||||
nuseless_productions,
|
||||
(nuseless_productions == 1 ? "" : "s"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user