X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/75142d452b7f6bc3b6be3d8a08c0f602fd157ec5..e9f87b5b7df2e328d2e4196d276c0d96594c906b:/src/gram.c diff --git a/src/gram.c b/src/gram.c index 219bbee5..f6f39f5a 100644 --- a/src/gram.c +++ b/src/gram.c @@ -21,6 +21,7 @@ #include "system.h" #include "gram.h" +#include "symtab.h" #include "reader.h" /* comments for these variables are in gram.h */ @@ -34,12 +35,9 @@ int nvars; short *ritem = NULL; int nritems; -rule_t *rule_table = NULL; -short *rprec = NULL; -short *rprecsym = NULL; -short *sprec = NULL; -short *rassoc = NULL; -short *sassoc = NULL; +rule_t *rules = NULL; + +struct bucket **symbols = NULL; short *token_translations = NULL; int start_symbol; @@ -64,9 +62,9 @@ ritem_print (FILE *out) fputs ("RITEM\n", out); for (i = 0; i < nritems; ++i) if (ritem[i] >= 0) - fprintf (out, " %s", tags[ritem[i]]); + fprintf (out, " %s", symbols[ritem[i]]->tag); else - fprintf (out, " (rule %d)\n", -ritem[i]); + fprintf (out, " (rule %d)\n", -ritem[i] - 1); fputs ("\n\n", out); } @@ -78,14 +76,14 @@ ritem_print (FILE *out) size_t ritem_longest_rhs (void) { - short *itemp; int length; int max; + int i; length = 0; max = 0; - for (itemp = ritem; *itemp; itemp++) - if (*itemp > 0) + for (i = 0; i < nritems; ++i) + if (ritem[i] >= 0) { length++; }