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 |
|
|
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 |
} |
} |