/* Type definitions for nondeterministic finite state machine for Bison.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
}
-/*-------------------------------------------------------------------.
-| Return the state such these TRANSITIONS contain a shift/goto to it |
-| on S. Abort if none found. |
-`-------------------------------------------------------------------*/
+/*-------------------------------------------------------.
+| Return the state such that SHIFTS contain a shift/goto |
+| to it on SYM. Abort if none found. |
+`-------------------------------------------------------*/
state *
-transitions_to (transitions *shifts, symbol_number s)
+transitions_to (transitions *shifts, symbol_number sym)
{
int j;
for (j = 0; j < shifts->num; j++)
- if (TRANSITION_SYMBOL (shifts, j) == s)
+ if (TRANSITION_SYMBOL (shifts, j) == sym)
return shifts->states[j];
abort ();
}
{
bitset_iterator biter;
int k;
- int not_first = 0;
+ char const *sep = "";
fprintf (out, " [");
BITSET_FOR_EACH (biter, reds->lookaheads[red], k, 0)
- fprintf (out, "%s%s",
- not_first++ ? ", " : "",
- symbols[k]->tag);
+ {
+ fprintf (out, "%s%s", sep, symbols[k]->tag);
+ sep = ", ";
+ }
fprintf (out, "]");
}
}
return state_compare (s1, s2);
}
-static inline unsigned int
-state_hash (state const *s, unsigned int tablesize)
+static inline size_t
+state_hash (state const *s, size_t tablesize)
{
/* Add up the state's item numbers to get a hash key. */
- unsigned int key = 0;
+ size_t key = 0;
int i;
for (i = 0; i < s->nitems; ++i)
key += s->items[i];
return key % tablesize;
}
-static unsigned int
-state_hasher (void const *s, unsigned int tablesize)
+static size_t
+state_hasher (void const *s, size_t tablesize)
{
return state_hash (s, tablesize);
}