mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 09:13:04 +00:00
style: minor changes
* examples/c/calc/calc.y, src/lalr.c: Reduce scope. * src/gram.c: Prefer < to >.
This commit is contained in:
@@ -84,9 +84,8 @@ yyerror (char const *s)
|
|||||||
int
|
int
|
||||||
main (int argc, char const* argv[])
|
main (int argc, char const* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
/* Enable parse traces on option -p. */
|
/* Enable parse traces on option -p. */
|
||||||
for (i = 1; i < argc; ++i)
|
for (int i = 1; i < argc; ++i)
|
||||||
if (!strcmp(argv[i], "-p"))
|
if (!strcmp(argv[i], "-p"))
|
||||||
yydebug = 1;
|
yydebug = 1;
|
||||||
return yyparse ();
|
return yyparse ();
|
||||||
|
|||||||
@@ -52,9 +52,8 @@ rule const *
|
|||||||
item_rule (item_number const *item)
|
item_rule (item_number const *item)
|
||||||
{
|
{
|
||||||
item_number const *sp = item;
|
item_number const *sp = item;
|
||||||
while (*sp >= 0)
|
while (0 <= *sp)
|
||||||
++sp;
|
++sp;
|
||||||
|
|
||||||
rule_number r = item_number_as_rule_number (*sp);
|
rule_number r = item_number_as_rule_number (*sp);
|
||||||
return &rules[r];
|
return &rules[r];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "relation.h"
|
#include "relation.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
|
|
||||||
|
/* goto_map[nterm - NTOKENS] -> number of gotos. */
|
||||||
goto_number *goto_map = NULL;
|
goto_number *goto_map = NULL;
|
||||||
goto_number ngotos = 0;
|
goto_number ngotos = 0;
|
||||||
state_number *from_state = NULL;
|
state_number *from_state = NULL;
|
||||||
@@ -70,8 +71,7 @@ static goto_list **lookback;
|
|||||||
void
|
void
|
||||||
set_goto_map (void)
|
set_goto_map (void)
|
||||||
{
|
{
|
||||||
goto_number *temp_map = xnmalloc (nvars + 1, sizeof *temp_map);
|
/* Count the number of gotos (ngotos) per nterm (goto_map). */
|
||||||
|
|
||||||
goto_map = xcalloc (nvars + 1, sizeof *goto_map);
|
goto_map = xcalloc (nvars + 1, sizeof *goto_map);
|
||||||
ngotos = 0;
|
ngotos = 0;
|
||||||
for (state_number s = 0; s < nstates; ++s)
|
for (state_number s = 0; s < nstates; ++s)
|
||||||
@@ -80,14 +80,13 @@ set_goto_map (void)
|
|||||||
for (int i = sp->num - 1; 0 <= i && TRANSITION_IS_GOTO (sp, i); --i)
|
for (int i = sp->num - 1; 0 <= i && TRANSITION_IS_GOTO (sp, i); --i)
|
||||||
{
|
{
|
||||||
ngotos++;
|
ngotos++;
|
||||||
|
|
||||||
/* Abort if (ngotos + 1) would overflow. */
|
/* Abort if (ngotos + 1) would overflow. */
|
||||||
aver (ngotos != GOTO_NUMBER_MAXIMUM);
|
aver (ngotos != GOTO_NUMBER_MAXIMUM);
|
||||||
|
|
||||||
goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
|
goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goto_number *temp_map = xnmalloc (nvars + 1, sizeof *temp_map);
|
||||||
{
|
{
|
||||||
goto_number k = 0;
|
goto_number k = 0;
|
||||||
for (symbol_number i = ntokens; i < nsyms; ++i)
|
for (symbol_number i = ntokens; i < nsyms; ++i)
|
||||||
|
|||||||
Reference in New Issue
Block a user