]> git.saurik.com Git - bison.git/blobdiff - src/nullable.c
Propagate more token_number_t.
[bison.git] / src / nullable.c
index f8c9b32e5cf523b36742cb375ef0a087188ce2be..ae02db757a725f06ad1cf9fd8f9bef9780cf8213 100644 (file)
@@ -47,11 +47,11 @@ void
 set_nullable (void)
 {
   int ruleno;
-  short *s1;
-  short *s2;
+  token_number_t *s1;
+  token_number_t *s2;
   shorts *p;
 
-  short *squeue = XCALLOC (short, nvars);
+  token_number_t *squeue = XCALLOC (token_number_t, nvars);
   short *rcount = XCALLOC (short, nrules + 1);
   /* RITEM contains all the rules, including useless productions.
      Hence we must allocate room for useless nonterminals too.  */
@@ -71,19 +71,19 @@ set_nullable (void)
   for (ruleno = 1; ruleno < nrules + 1; ++ruleno)
     if (rules[ruleno].useful)
       {
-       if (ritem[rules[ruleno].rhs] >= 0)
+       if (rules[ruleno].rhs[0] >= 0)
          {
            /* This rule has a non empty RHS. */
-           short *r;
+           item_number_t *r;
            int any_tokens = 0;
-           for (r = &ritem[rules[ruleno].rhs]; *r >= 0; ++r)
+           for (r = rules[ruleno].rhs; *r >= 0; ++r)
              if (ISTOKEN (*r))
                any_tokens = 1;
 
            /* This rule has only nonterminals: schedule it for the second
               pass.  */
            if (!any_tokens)
-             for (r = &ritem[rules[ruleno].rhs]; *r >= 0; ++r)
+             for (r = rules[ruleno].rhs; *r >= 0; ++r)
                {
                  rcount[ruleno]++;
                  p->next = rsets[*r];
@@ -95,11 +95,11 @@ set_nullable (void)
        else
          {
            /* This rule has an empty RHS. */
-           assert (ritem[rules[ruleno].rhs] == -ruleno);
-           if (rules[ruleno].useful && !nullable[rules[ruleno].lhs])
+           assert (rules[ruleno].rhs[0] == -ruleno);
+           if (rules[ruleno].useful && !nullable[rules[ruleno].lhs->number])
              {
-               nullable[rules[ruleno].lhs] = 1;
-               *s2++ = rules[ruleno].lhs;
+               nullable[rules[ruleno].lhs->number] = 1;
+               *s2++ = rules[ruleno].lhs->number;
              }
          }
       }
@@ -109,10 +109,10 @@ set_nullable (void)
       {
        ruleno = p->value;
        if (--rcount[ruleno] == 0)
-         if (rules[ruleno].useful && !nullable[rules[ruleno].lhs])
+         if (rules[ruleno].useful && !nullable[rules[ruleno].lhs->number])
            {
-             nullable[rules[ruleno].lhs] = 1;
-             *s2++ = rules[ruleno].lhs;
+             nullable[rules[ruleno].lhs->number] = 1;
+             *s2++ = rules[ruleno].lhs->number;
            }
       }