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

Diff of /bison/src/nullable.c

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

revision 1.39 by eggert, Fri Dec 13 08:30:08 2002 UTC revision 1.40 by eggert, Mon Feb 3 15:35:56 2003 UTC
# Line 1  Line 1 
1  /* Calculate which nonterminals can expand into the null string for Bison.  /* Calculate which nonterminals can expand into the null string for Bison.
2    
3     Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.     Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
4       Foundation, Inc.
5    
6     This file is part of Bison, the GNU Compiler Compiler.     This file is part of Bison, the GNU Compiler Compiler.
7    
# Line 81  nullable_compute (void) Line 82  nullable_compute (void)
82          if (rules_ruleno->rhs[0] >= 0)          if (rules_ruleno->rhs[0] >= 0)
83            {            {
84              /* This rule has a non empty RHS. */              /* This rule has a non empty RHS. */
85              item_number *r = NULL;              item_number *rp = NULL;
86              int any_tokens = 0;              int any_tokens = 0;
87              for (r = rules_ruleno->rhs; *r >= 0; ++r)              for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
88                if (ISTOKEN (*r))                if (ISTOKEN (*rp))
89                  any_tokens = 1;                  any_tokens = 1;
90    
91              /* This rule has only nonterminals: schedule it for the second              /* This rule has only nonterminals: schedule it for the second
92                 pass.  */                 pass.  */
93              if (!any_tokens)              if (!any_tokens)
94                for (r = rules_ruleno->rhs; *r >= 0; ++r)                for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
95                  {                  {
96                    rcount[ruleno]++;                    rcount[ruleno]++;
97                    p->next = rsets[*r - ntokens];                    p->next = rsets[*rp - ntokens];
98                    p->value = rules_ruleno;                    p->value = rules_ruleno;
99                    rsets[*r - ntokens] = p;                    rsets[*rp - ntokens] = p;
100                    p++;                    p++;
101                  }                  }
102            }            }

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

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