case Xcond_statement: free_cond_statement(cast(cond_statement, e)); break;
###### ComplexStatement Grammar
- | CondStatement $$NEWLINE ${ $0 = $<1; }$
+ | CondStatement ${ $0 = $<1; }$
###### Grammar
$0->condpart = $1.condpart; $1.condpart = NULL;
$0->dopart = $1.dopart; $1.dopart = NULL;
}$
- | SwitchPart CondSuffix ${
- $0 = $<2;
+ | SwitchPart CasePart CondSuffix ${
+ $0 = $<3;
$0->condpart = $<1;
+ $2->next = $0->casepart;
+ $0->casepart = $<2;
}$
| IfPart IfSuffix ${
$0 = $<2;
struct symbol *s;
struct symset LA = INIT_SYMSET;
unsigned short sn = 0;
+ struct symset LAnl = INIT_SYMSET;
+ unsigned short snnl = 0;
if (is->min_prefix == 0 ||
(bs > 0 && bs < is->min_prefix))
int to_end;
add_first(pr, bs+1, &LA, g, &to_end);
if (to_end) {
- if (pr->line_like)
- symset_add(&LA, TK_newline, 0);
- else {
- struct symset ss = set_find(g, is->items.data[i]);
- symset_union(&LA, &ss);
- }
+ struct symset ss = set_find(g, is->items.data[i]);
+ symset_union(&LA, &ss);
}
sn = save_set(g, LA);
LA = set_find(g, sn);
+ symset_add(&LAnl, TK_newline, 0);
+ snnl = save_set(g, LAnl);
+ LAnl = set_find(g, snnl);
}
/* Add productions for this symbol */
int itm = item_num(p2, 0);
int pos = symset_find(&is->items, itm);
if (pos < 0) {
- symset_add(&is->items, itm, sn);
+ if (g->productions[p2]->line_like)
+ symset_add(&is->items, itm, snnl);
+ else
+ symset_add(&is->items, itm, sn);
/* Will have re-ordered, so start
* from beginning again */
i = -1;
} else if (type >= LALR) {
struct symset ss = set_find(g, is->items.data[pos]);
struct symset tmp = INIT_SYMSET;
+ struct symset *la = &LA;
+ if (g->productions[p2]->line_like)
+ la = &LAnl;
symset_union(&tmp, &ss);
- if (symset_union(&tmp, &LA)) {
+ if (symset_union(&tmp, la)) {
is->items.data[pos] = save_set(g, tmp);
i = -1;
- }else
+ } else
symset_free(tmp);
}
}