mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
* src/lalr.c (maxrhs): Move to...
* src/gram.c, src/gram.h (ritem_longest_rhs): here. * src/lalr.c (build_relations): Adjust.
This commit is contained in:
33
src/lalr.c
33
src/lalr.c
@@ -194,37 +194,6 @@ set_state_table (void)
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------.
|
||||
| Return the size of the longest rule RHS. |
|
||||
`------------------------------------------*/
|
||||
|
||||
static size_t
|
||||
maxrhs (void)
|
||||
{
|
||||
short *itemp;
|
||||
int length;
|
||||
int max;
|
||||
|
||||
length = 0;
|
||||
max = 0;
|
||||
for (itemp = ritem; *itemp; itemp++)
|
||||
{
|
||||
if (*itemp > 0)
|
||||
{
|
||||
length++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (length > max)
|
||||
max = length;
|
||||
length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
initialize_LA (void)
|
||||
{
|
||||
@@ -497,7 +466,7 @@ static void
|
||||
build_relations (void)
|
||||
{
|
||||
short *edge = XCALLOC (short, ngotos + 1);
|
||||
short *states = XCALLOC (short, maxrhs () + 1);
|
||||
short *states = XCALLOC (short, ritem_longest_rhs () + 1);
|
||||
int i;
|
||||
|
||||
includes = XCALLOC (short *, ngotos);
|
||||
|
||||
Reference in New Issue
Block a user