/* Output the generated parsing program for Bison.
- Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
+ Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
}
static inline vector_number
-symbol_number_to_vector_number (symbol_number s)
+symbol_number_to_vector_number (symbol_number sym)
{
- return state_number_as_int (nstates) + s - ntokens;
+ return state_number_as_int (nstates) + sym - ntokens;
}
int nvectors;
int i, j;
reductions *reds = s->reductions;
- if (! glr_parser)
+ if (!nondeterministic_parser)
return;
for (j = 0; j < ntokens; j += 1)
transitions *trans = s->transitions;
errs *errp = s->errs;
/* Set to nonzero to inhibit having any default reduction. */
- int nodefault = 0;
- int conflicted = 0;
+ bool nodefault = false;
+ bool conflicted = false;
for (i = 0; i < ntokens; i++)
actrow[i] = conflrow[i] = 0;
/* and record this rule as the rule to use if that
token follows. */
if (actrow[j] != 0)
- conflicted = conflrow[j] = 1;
+ {
+ conflicted = true;
+ conflrow[j] = 1;
+ }
actrow[j] = rule_number_as_item_number (reds->rules[i]->number);
}
}
state *shift_state = trans->states[i];
if (actrow[sym] != 0)
- conflicted = conflrow[sym] = 1;
+ {
+ conflicted = true;
+ conflrow[sym] = 1;
+ }
actrow[sym] = state_number_as_int (shift_state->number);
/* Do not use any default reduction if there is a shift for
error */
if (sym == errtoken->number)
- nodefault = 1;
+ nodefault = true;
}
/* See which tokens are an explicit error in this state (due to
int j;
for (j = 0; j < ntokens; j++)
if (actrow[j] == rule_number_as_item_number (default_rule->number)
- && ! (glr_parser && conflrow[j]))
+ && ! (nondeterministic_parser && conflrow[j]))
actrow[j] = 0;
}
}
/* Allocate non defaulted actions. */
froms[s] = sp = CALLOC (sp1, count);
tos[s] = CALLOC (sp2, count);
- conflict_tos[s] = glr_parser ? CALLOC (sp3, count) : NULL;
+ conflict_tos[s] = nondeterministic_parser ? CALLOC (sp3, count) : NULL;
/* Store non defaulted actions. */
for (i = 0; i < ntokens; i++)
{
*sp1++ = i;
*sp2++ = actrow[i];
- if (glr_parser)
+ if (nondeterministic_parser)
*sp3++ = conflrow[i];
}
symbol_number j;
rule_number r;
- int nconflict = glr_parser ? conflicts_total_count () : 0;
+ int nconflict = nondeterministic_parser ? conflicts_total_count () : 0;
CALLOC (yydefact, nstates);
conflict_list_cnt = 1;
/* Find the rules which are reduced. */
- if (!glr_parser)
+ if (!nondeterministic_parser)
for (r = 0; r < nrules; ++r)
rules[r].useful = false;
/* Now that the parser was computed, we can find which rules are
really reduced, and which are not because of SR or RR
conflicts. */
- if (!glr_parser)
+ if (!nondeterministic_parser)
{
for (j = 0; j < ntokens; ++j)
if (actrow[j] < 0 && actrow[j] != ACTION_NUMBER_MINIMUM)
base_number *to = tos[i];
unsigned int *conflict_to = conflict_tos[i];
- if (! t)
+ if (!t)
abort ();
for (j = lowzero - from[0]; ; j++)
{
int k;
- int ok = 1;
+ bool ok = true;
if (table_size <= j)
abort ();
table_grow (loc);
if (table[loc] != 0)
- ok = 0;
+ ok = false;
}
for (k = 0; ok && k < vector; k++)
if (pos[k] == j)
- ok = 0;
+ ok = false;
if (ok)
{
{
loc = j + from[k];
table[loc] = to[k];
- if (glr_parser && conflict_to != NULL)
+ if (nondeterministic_parser && conflict_to != NULL)
conflict_table[loc] = conflict_to[k];
check[loc] = from[k];
}