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

Diff of /bison/src/output.c

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

revision 1.169 by hilfinger, Fri Jun 28 02:26:43 2002 UTC revision 1.170 by akim, Fri Jun 28 08:41:45 2002 UTC
# Line 378  conflict_row (state_t *state) Line 378  conflict_row (state_t *state)
378    if (! glr_parser)    if (! glr_parser)
379      return;      return;
380    
381    for (j = 0; j < ntokens; j += 1)    for (j = 0; j < ntokens; j += 1)
382      if (conflrow[j])      if (conflrow[j])
383        {        {
384          conflrow[j] = conflict_list_cnt;          conflrow[j] = conflict_list_cnt;
385    
# Line 388  conflict_row (state_t *state) Line 388  conflict_row (state_t *state)
388          for (i = 0; i < state->nlookaheads; i += 1)          for (i = 0; i < state->nlookaheads; i += 1)
389            if (bitset_test (state->lookaheads[i], j)            if (bitset_test (state->lookaheads[i], j)
390                && actrow[j] != -state->lookaheads_rule[i]->number)                && actrow[j] != -state->lookaheads_rule[i]->number)
391              {                    {
392                assert (conflict_list_free > 0);                assert (conflict_list_free > 0);
393                conflict_list[conflict_list_cnt]                conflict_list[conflict_list_cnt]
394                  = state->lookaheads_rule[i]->number;                  = state->lookaheads_rule[i]->number;
395                conflict_list_cnt += 1;                conflict_list_cnt += 1;
396                conflict_list_free -= 1;                conflict_list_free -= 1;
397              }              }
398            
399          /* Leave a 0 at the end */          /* Leave a 0 at the end */
400          assert (conflict_list_free > 0);          assert (conflict_list_free > 0);
401          conflict_list_cnt += 1;          conflict_list_cnt += 1;
# Line 519  action_row (state_t *state) Line 519  action_row (state_t *state)
519    
520            /* GLR parsers need space for conflict lists, so we can't            /* GLR parsers need space for conflict lists, so we can't
521               default conflicted entries.  For non-conflicted entries               default conflicted entries.  For non-conflicted entries
522               or as long as we are not building a GLR parser,               or as long as we are not building a GLR parser,
523               actions that match the default are replaced with zero,               actions that match the default are replaced with zero,
524               which means "use the default". */               which means "use the default". */
525    
# Line 554  save_row (int state) Line 554  save_row (int state)
554  {  {
555    int i;    int i;
556    int count;    int count;
557    short *sp;    short *sp = NULL;
558    short *sp1;    short *sp1 = NULL;
559    short *sp2;    short *sp2 = NULL;
560    unsigned int *sp3;    unsigned int *sp3 = NULL;
561    
562    count = 0;    count = 0;
563    for (i = 0; i < ntokens; i++)    for (i = 0; i < ntokens; i++)
# Line 570  save_row (int state) Line 570  save_row (int state)
570    froms[state] = sp1 = sp = XCALLOC (short, count);    froms[state] = sp1 = sp = XCALLOC (short, count);
571    tos[state] = sp2 = XCALLOC (short, count);    tos[state] = sp2 = XCALLOC (short, count);
572    if (glr_parser)    if (glr_parser)
573      conflict_tos[state] = sp3 = XCALLOC (unsigned int, count);        conflict_tos[state] = sp3 = XCALLOC (unsigned int, count);
574    else    else
575      conflict_tos[state] = NULL;      conflict_tos[state] = NULL;
576    
577    for (i = 0; i < ntokens; i++)    for (i = 0; i < ntokens; i++)
# Line 612  token_actions (void) Line 612  token_actions (void)
612        conflict_list = XCALLOC (unsigned int, 1 + 2 * nconflict);        conflict_list = XCALLOC (unsigned int, 1 + 2 * nconflict);
613        conflict_list_free = 2 * nconflict;        conflict_list_free = 2 * nconflict;
614        conflict_list_cnt = 1;        conflict_list_cnt = 1;
615      }      }
616    else    else
617      conflict_list_free = conflict_list_cnt = 0;      conflict_list_free = conflict_list_cnt = 0;
618    
619    for (i = 0; i < nstates; ++i)    for (i = 0; i < nstates; ++i)
# Line 667  merger_output (FILE *out) Line 667  merger_output (FILE *out)
667    merger_list* p;    merger_list* p;
668    
669    fputs ("m4_define([b4_mergers], \n[[", out);    fputs ("m4_define([b4_mergers], \n[[", out);
670    for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next)    for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next)
671      {      {
672        if (p->type[0] == '\0')        if (p->type[0] == '\0')
673          fprintf (out, "  case %d: yyval = %s (*yy0, *yy1); break;\n",          fprintf (out, "  case %d: yyval = %s (*yy0, *yy1); break;\n",
674                   n, p->name);                   n, p->name);
675        else        else
# Line 1103  output_conflicts (void) Line 1103  output_conflicts (void)
1103    if (! glr_parser)    if (! glr_parser)
1104      return;      return;
1105    
1106    muscle_insert_unsigned_int_table ("conflict_list_heads", conflict_table,    muscle_insert_unsigned_int_table ("conflict_list_heads", conflict_table,
1107                                      conflict_table[0], 1, high+1);                                      conflict_table[0], 1, high+1);
1108    muscle_insert_unsigned_int_table ("conflicting_rules", conflict_list,    muscle_insert_unsigned_int_table ("conflicting_rules", conflict_list,
1109                               conflict_list[0], 1, conflict_list_cnt);                               conflict_list[0], 1, conflict_list_cnt);
1110    
1111    XFREE (conflict_table);    XFREE (conflict_table);

Legend:
Removed from v.1.169  
changed lines
  Added in v.1.170

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