/[bison]/bison/src/tables.c
ViewVC logotype

Diff of /bison/src/tables.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by eggert, Fri Nov 15 20:32:21 2002 UTC revision 1.14 by eggert, Thu Nov 21 05:25:55 2002 UTC
# Line 1  Line 1 
1  /* Output the generated parsing program for bison,  /* Output the generated parsing program for Bison.
2     Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002     Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
3     Free Software Foundation, Inc.     Free Software Foundation, Inc.
4    
# Line 33  Line 33 
33  #include "conflicts.h"  #include "conflicts.h"
34  #include "tables.h"  #include "tables.h"
35    
36  /* Several tables will be indexed both by state and nonterminal  /* Several tables are indexed both by state and nonterminal numbers.
37     numbers.  We call `vector' such a thing (= either a state or a     We call such an index a `vector'; i.e., a vector is either a state
38     symbol number.     or a nonterminal number.
39    
40     Of course vector_number_t ought to be wide enough to contain     Of course vector_number_t ought to be wide enough to contain
41     state_number_t and symbol_number_t.  */     state_number_t and symbol_number_t.  */
# Line 190  conflict_row (state_t *state) Line 190  conflict_row (state_t *state)
190                && (actrow[j]                && (actrow[j]
191                    != rule_number_as_item_number (reds->rules[i]->number)))                    != rule_number_as_item_number (reds->rules[i]->number)))
192              {              {
193                assert (conflict_list_free > 0);                if (conflict_list_free <= 0)
194                    abort ();
195                conflict_list[conflict_list_cnt] = reds->rules[i]->number + 1;                conflict_list[conflict_list_cnt] = reds->rules[i]->number + 1;
196                conflict_list_cnt += 1;                conflict_list_cnt += 1;
197                conflict_list_free -= 1;                conflict_list_free -= 1;
198              }              }
199    
200          /* Leave a 0 at the end.  */          /* Leave a 0 at the end.  */
201          assert (conflict_list_free > 0);          if (conflict_list_free <= 0)
202              abort ();
203          conflict_list_cnt += 1;          conflict_list_cnt += 1;
204          conflict_list_free -= 1;          conflict_list_free -= 1;
205        }        }
# Line 654  pack_vector (vector_number_t vector) Line 656  pack_vector (vector_number_t vector)
656    base_t *to = tos[i];    base_t *to = tos[i];
657    unsigned int *conflict_to = conflict_tos[i];    unsigned int *conflict_to = conflict_tos[i];
658    
659    assert (t);    if (! t)
660        abort ();
661    
662    for (j = lowzero - from[0]; j < (int) table_size; j++)    for (j = lowzero - from[0]; ; j++)
663      {      {
664        int k;        int k;
665        int ok = 1;        int ok = 1;
666    
667          if ((int) table_size <= j)
668            abort ();
669    
670        for (k = 0; ok && k < t; k++)        for (k = 0; ok && k < t; k++)
671          {          {
672            loc = j + state_number_as_int (from[k]);            loc = j + state_number_as_int (from[k]);
# Line 692  pack_vector (vector_number_t vector) Line 698  pack_vector (vector_number_t vector)
698            if (loc > high)            if (loc > high)
699              high = loc;              high = loc;
700    
701            assert (BASE_MIN <= j && j <= BASE_MAX);            if (! (BASE_MIN <= j && j <= BASE_MAX))
702                abort ();
703            return j;            return j;
704          }          }
705      }      }
 #define pack_vector_succeeded 0  
   assert (pack_vector_succeeded);  
   return 0;  
706  }  }
707    
708    
# Line 784  tables_generate (void) Line 788  tables_generate (void)
788  {  {
789    int i;    int i;
790    
791    /* That's a poor way to make sure the sizes are properly corelated,    /* This is a poor way to make sure the sizes are properly
792       in particular the signedness is not taking into account, but it's       correlated.  In particular the signedness is not taken into
793       not useless.  */       account.  But it's not useless.  */
794    assert (sizeof (nvectors) >= sizeof (nstates));    verify (sizes_are_properly_correlated,
795    assert (sizeof (nvectors) >= sizeof (nvars));            (sizeof nstates <= sizeof nvectors
796               && sizeof nvars <= sizeof nvectors));
797    
798    nvectors = state_number_as_int (nstates) + nvars;    nvectors = state_number_as_int (nstates) + nvars;
799    

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26