summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
663f971)
Sometimes I use 'again', sometimes 'check_again'.
Change all to use 'check_again'.
Signed-off-by: NeilBrown <neil@brown.name>
+ for (check_again = 0, p = 0;
p < g->production_count;
p < g->production_count-1
p < g->production_count;
p < g->production_count-1
- ? p++ : again ? (again = 0, p = 0)
+ ? p++ : check_again ? (check_again = 0, p = 0)
: p++) {
struct production *pr = g->productions[p];
int b;
: p++) {
struct production *pr = g->productions[p];
int b;
break;
if (symset_union(&g->follow[bs->num],
&g->follow[pr->head->num]))
break;
if (symset_union(&g->follow[bs->num],
&g->follow[pr->head->num]))
if (!bs->nullable)
break;
}
if (!bs->nullable)
break;
}
###### functions
static void build_follow(struct grammar *g)
{
###### functions
static void build_follow(struct grammar *g)
{
g->follow = calloc(g->num_syms, sizeof(g->follow[0]));
for (s = 0; s < g->num_syms; s++)
g->follow[s] = INIT_SYMSET;
g->follow = calloc(g->num_syms, sizeof(g->follow[0]));
for (s = 0; s < g->num_syms; s++)
g->follow[s] = INIT_SYMSET;
continue;
if (s->line_like)
is->starts_line = 1;
continue;
if (s->line_like)
is->starts_line = 1;
if (type >= LALR) {
// Need the LA set.
int to_end;
if (type >= LALR) {
// Need the LA set.
int to_end;
{
struct symset first = INIT_SYMSET;
struct itemset *is;
{
struct symset first = INIT_SYMSET;
struct itemset *is;
unsigned short la = 0;
if (type >= LALR) {
// LA set just has eof
unsigned short la = 0;
if (type >= LALR) {
// LA set just has eof
// production 0, offset 0 (with no data)
symset_add(&first, item_num(0, 0), la);
add_itemset(g, first, Non, 0, type);
// production 0, offset 0 (with no data)
symset_add(&first, item_num(0, 0), la);
add_itemset(g, first, Non, 0, type);
- for (again = 0, is = g->items;
+ for (check_again = 0, is = g->items;
- is = is->next ?: again ? (again = 0, g->items) : NULL) {
+ is = is->next ?: check_again ? (check_again = 0, g->items) : NULL) {
int i;
struct symset done = INIT_SYMSET;
if (is->completed)
continue;
is->completed = 1;
int i;
struct symset done = INIT_SYMSET;
if (is->completed)
continue;
is->completed = 1;
## complete itemset
## derive itemsets
symset_free(done);
## complete itemset
## derive itemsets
symset_free(done);