mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 09:13:04 +00:00
Formatting changes of various comments.
Respect the GNU coding standards at various places. Don't use `_()' when no translation is needed.
This commit is contained in:
@@ -1,47 +1,47 @@
|
|||||||
/* Subroutines for bison
|
/* Subroutines for bison
|
||||||
Copyright (C) 1984, 1989 Free Software Foundation, Inc.
|
Copyright (C) 1984, 1989, 2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
Bison is free software; you can redistribute it and/or modify
|
Bison is free software; you can redistribute it and/or modify it
|
||||||
it under the terms of the GNU General Public License as published by
|
under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2, or (at your option)
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
any later version.
|
any later version.
|
||||||
|
|
||||||
Bison is distributed in the hope that it will be useful,
|
Bison is distributed in the hope that it will be useful, but
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
GNU General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Bison; see the file COPYING. If not, write to
|
along with Bison; see the file COPYING. If not, write to the Free
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
Boston, MA 02111-1307, USA. */
|
02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
/* subroutines of file LR0.c.
|
/* Subroutines of file LR0.c.
|
||||||
|
|
||||||
Entry points:
|
Entry points:
|
||||||
|
|
||||||
closure (items, n)
|
closure (items, n)
|
||||||
|
|
||||||
Given a vector of item numbers items, of length n,
|
Given a vector of item numbers items, of length n, set up ruleset and
|
||||||
set up ruleset and itemset to indicate what rules could be run
|
itemset to indicate what rules could be run and which items could be
|
||||||
and which items could be accepted when those items are the active ones.
|
accepted when those items are the active ones.
|
||||||
|
|
||||||
ruleset contains a bit for each rule. closure sets the bits
|
ruleset contains a bit for each rule. closure sets the bits for all
|
||||||
for all rules which could potentially describe the next input to be read.
|
rules which could potentially describe the next input to be read.
|
||||||
|
|
||||||
itemset is a vector of item numbers; itemsetend points to just beyond the end
|
itemset is a vector of item numbers; itemsetend points to just beyond
|
||||||
of the part of it that is significant.
|
the end of the part of it that is significant. closure places there
|
||||||
closure places there the indices of all items which represent units of
|
the indices of all items which represent units of input that could
|
||||||
input that could arrive next.
|
arrive next.
|
||||||
|
|
||||||
initialize_closure (n)
|
initialize_closure (n)
|
||||||
|
|
||||||
Allocates the itemset and ruleset vectors,
|
Allocates the itemset and ruleset vectors, and precomputes useful data
|
||||||
and precomputes useful data so that closure can be called.
|
so that closure can be called. n is the number of elements to
|
||||||
n is the number of elements to allocate for itemset.
|
allocate for itemset.
|
||||||
|
|
||||||
finalize_closure ()
|
finalize_closure ()
|
||||||
|
|
||||||
@@ -155,11 +155,15 @@ set_fderives (void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* set firsts to be an nvars by nvars bit matrix indicating which items
|
/* set firsts to be an nvars by nvars bit matrix indicating which
|
||||||
can represent the beginning of the input corresponding to which other items.
|
items can represent the beginning of the input corresponding to
|
||||||
For example, if some rule expands symbol 5 into the sequence of symbols 8 3 20,
|
which other items.
|
||||||
the symbol 8 can be the beginning of the data for symbol 5,
|
|
||||||
so the bit [8 - ntokens, 5 - ntokens] in firsts is set. */
|
For example, if some rule expands symbol 5 into the sequence of
|
||||||
|
symbols 8 3 20, the symbol 8 can be the beginning of the data for
|
||||||
|
symbol 5, so the bit [8 - ntokens, 5 - ntokens] in firsts is
|
||||||
|
set. */
|
||||||
|
|
||||||
void
|
void
|
||||||
set_firsts (void)
|
set_firsts (void)
|
||||||
{
|
{
|
||||||
@@ -195,7 +199,7 @@ set_firsts (void)
|
|||||||
RTC(firsts, nvars);
|
RTC(firsts, nvars);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
print_firsts();
|
print_firsts ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,9 +303,9 @@ int n;
|
|||||||
{
|
{
|
||||||
register short *isp;
|
register short *isp;
|
||||||
|
|
||||||
printf("\n\nn = %d\n\n", n);
|
printf ("\n\nn = %d\n\n", n);
|
||||||
for (isp = itemset; isp < itemsetend; isp++)
|
for (isp = itemset; isp < itemsetend; isp++)
|
||||||
printf(" %d\n", *isp);
|
printf (" %d\n", *isp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -312,17 +316,17 @@ print_firsts (void)
|
|||||||
register int j;
|
register int j;
|
||||||
register unsigned *rowp;
|
register unsigned *rowp;
|
||||||
|
|
||||||
printf(_("\n\n\nFIRSTS\n\n"));
|
printf ("\n\n\nFIRSTS\n\n");
|
||||||
|
|
||||||
for (i = ntokens; i < nsyms; i++)
|
for (i = ntokens; i < nsyms; i++)
|
||||||
{
|
{
|
||||||
printf(_("\n\n%s firsts\n\n"), tags[i]);
|
printf ("\n\n%s firsts\n\n", tags[i]);
|
||||||
|
|
||||||
rowp = firsts + ((i - ntokens) * varsetsize);
|
rowp = firsts + ((i - ntokens) * varsetsize);
|
||||||
|
|
||||||
for (j = 0; j < nvars; j++)
|
for (j = 0; j < nvars; j++)
|
||||||
if (BITISSET (rowp, j))
|
if (BITISSET (rowp, j))
|
||||||
printf(" %s\n", tags[j + ntokens]);
|
printf (" %s\n", tags[j + ntokens]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,16 +338,16 @@ print_fderives (void)
|
|||||||
register int j;
|
register int j;
|
||||||
register unsigned *rp;
|
register unsigned *rp;
|
||||||
|
|
||||||
printf(_("\n\n\nFDERIVES\n"));
|
printf ("\n\n\nFDERIVES\n");
|
||||||
|
|
||||||
for (i = ntokens; i < nsyms; i++)
|
for (i = ntokens; i < nsyms; i++)
|
||||||
{
|
{
|
||||||
printf(_("\n\n%s derives\n\n"), tags[i]);
|
printf ("\n\n%s derives\n\n", tags[i]);
|
||||||
rp = fderives + i * rulesetsize;
|
rp = fderives + i * rulesetsize;
|
||||||
|
|
||||||
for (j = 0; j <= nrules; j++)
|
for (j = 0; j <= nrules; j++)
|
||||||
if (BITISSET (rp, j))
|
if (BITISSET (rp, j))
|
||||||
printf(" %d\n", j);
|
printf (" %d\n", j);
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|||||||
Reference in New Issue
Block a user