/[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.102 by akim, Thu Dec 27 18:04:28 2001 UTC revision 1.103 by akim, Thu Dec 27 18:05:18 2001 UTC
# Line 323  output_rule_data (void) Line 323  output_rule_data (void)
323  `------------------------------------------------------------------*/  `------------------------------------------------------------------*/
324    
325  static int  static int
326  action_row (int state)  action_row (state_t *state)
327  {  {
328    int i;    int i;
   int m = 0;  
   int n = 0;  
329    int default_rule = 0;    int default_rule = 0;
330    reductions *redp = state_table[state]->reductions;    reductions *redp = state->reductions;
331    int nreds = redp ? redp->nreds : 0;    int nreds = redp ? redp->nreds : 0;
332    shifts *shiftp = state_table[state]->shifts;    shifts *shiftp = state->shifts;
333    errs *errp = state_table[state]->errs;    errs *errp = state->errs;
334    /* set nonzero to inhibit having any default reduction */    /* set nonzero to inhibit having any default reduction */
335    int nodefault = 0;    int nodefault = 0;
336    
# Line 344  action_row (int state) Line 342  action_row (int state)
342        int j;        int j;
343        /* loop over all the rules available here which require        /* loop over all the rules available here which require
344           lookahead */           lookahead */
345        m = state_table[state]->lookaheadsp;        for (i = state->nlookaheads - 1; i >= 0; --i)
       n = state_table[state + 1]->lookaheadsp;  
   
       for (i = n - 1; i >= m; i--)  
346          /* and find each token which the rule finds acceptable          /* and find each token which the rule finds acceptable
347             to come next */             to come next */
348          for (j = 0; j < ntokens; j++)          for (j = 0; j < ntokens; j++)
349            /* and record this rule as the rule to use if that            /* and record this rule as the rule to use if that
350               token follows.  */               token follows.  */
351            if (BITISSET (LA (i), j))            if (BITISSET (LA (state->lookaheadsp + i), j))
352              actrow[j] = -LAruleno[i];              actrow[j] = -LAruleno[state->lookaheadsp + i];
353      }      }
354    
355    /* Now see which tokens are allowed for shifts in this state.  For    /* Now see which tokens are allowed for shifts in this state.  For
# Line 394  action_row (int state) Line 389  action_row (int state)
389    
390    if (nreds >= 1 && !nodefault)    if (nreds >= 1 && !nodefault)
391      {      {
392        if (state_table[state]->consistent)        if (state->consistent)
393          default_rule = redp->rules[0];          default_rule = redp->rules[0];
394        else        else
395          {          {
396            int max = 0;            int max = 0;
397            for (i = m; i < n; i++)            for (i = 0; i < state->nlookaheads; i++)
398              {              {
399                int count = 0;                int count = 0;
400                int rule = -LAruleno[i];                int rule = -LAruleno[state->lookaheadsp + i];
401                int j;                int j;
402    
403                for (j = 0; j < ntokens; j++)                for (j = 0; j < ntokens; j++)
# Line 492  token_actions (void) Line 487  token_actions (void)
487    actrow = XCALLOC (short, ntokens);    actrow = XCALLOC (short, ntokens);
488    for (i = 0; i < nstates; ++i)    for (i = 0; i < nstates; ++i)
489      {      {
490        yydefact[i] = action_row (i);        yydefact[i] = action_row (state_table[i]);
491        save_row (i);        save_row (i);
492      }      }
493    

Legend:
Removed from v.1.102  
changed lines
  Added in v.1.103

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