mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 08:13:02 +00:00
style: use item_rule
* src/print-graph.c, src/print-xml.c: here.
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include "print-graph.h"
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#include "closure.h"
|
#include "closure.h"
|
||||||
@@ -30,7 +32,6 @@
|
|||||||
#include "graphviz.h"
|
#include "graphviz.h"
|
||||||
#include "lalr.h"
|
#include "lalr.h"
|
||||||
#include "lr0.h"
|
#include "lr0.h"
|
||||||
#include "print-graph.h"
|
|
||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
@@ -63,12 +64,7 @@ print_core (struct obstack *oout, state *s)
|
|||||||
for (size_t i = 0; i < snritems; ++i)
|
for (size_t i = 0; i < snritems; ++i)
|
||||||
{
|
{
|
||||||
item_number const *sp1 = ritem + sitems[i];
|
item_number const *sp1 = ritem + sitems[i];
|
||||||
item_number const *sp = sp1;
|
rule const *r = item_rule (sp1);
|
||||||
|
|
||||||
while (0 <= *sp)
|
|
||||||
sp++;
|
|
||||||
|
|
||||||
rule *r = &rules[item_number_as_rule_number (*sp)];
|
|
||||||
|
|
||||||
obstack_printf (oout, "%3d ", r->number);
|
obstack_printf (oout, "%3d ", r->number);
|
||||||
if (previous_lhs && UNIQSTR_EQ (previous_lhs->symbol->tag,
|
if (previous_lhs && UNIQSTR_EQ (previous_lhs->symbol->tag,
|
||||||
@@ -79,13 +75,13 @@ print_core (struct obstack *oout, state *s)
|
|||||||
obstack_printf (oout, "%s: ", escape (r->lhs->symbol->tag));
|
obstack_printf (oout, "%s: ", escape (r->lhs->symbol->tag));
|
||||||
previous_lhs = r->lhs;
|
previous_lhs = r->lhs;
|
||||||
|
|
||||||
for (sp = r->rhs; sp < sp1; sp++)
|
for (item_number const *sp = r->rhs; sp < sp1; sp++)
|
||||||
obstack_printf (oout, "%s ", escape (symbols[*sp]->tag));
|
obstack_printf (oout, "%s ", escape (symbols[*sp]->tag));
|
||||||
|
|
||||||
obstack_1grow (oout, '.');
|
obstack_1grow (oout, '.');
|
||||||
|
|
||||||
if (0 <= *r->rhs)
|
if (0 <= *r->rhs)
|
||||||
for (/* Nothing */; *sp >= 0; ++sp)
|
for (item_number const *sp = sp1; 0 <= *sp; ++sp)
|
||||||
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
||||||
else
|
else
|
||||||
obstack_printf (oout, " %%empty");
|
obstack_printf (oout, " %%empty");
|
||||||
|
|||||||
@@ -77,14 +77,8 @@ print_core (FILE *out, int level, state *s)
|
|||||||
{
|
{
|
||||||
bool printed = false;
|
bool printed = false;
|
||||||
item_number *sp1 = ritem + sitems[i];
|
item_number *sp1 = ritem + sitems[i];
|
||||||
item_number *sp = sp1;
|
rule const *r = item_rule (sp1);
|
||||||
rule *r;
|
item_number *sp = r->rhs;
|
||||||
|
|
||||||
while (0 <= *sp)
|
|
||||||
sp++;
|
|
||||||
|
|
||||||
r = &rules[item_number_as_rule_number (*sp)];
|
|
||||||
sp = r->rhs;
|
|
||||||
|
|
||||||
/* Display the lookahead tokens? */
|
/* Display the lookahead tokens? */
|
||||||
if (item_number_is_rule_number (*sp1))
|
if (item_number_is_rule_number (*sp1))
|
||||||
|
|||||||
Reference in New Issue
Block a user