mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 21:32:29 +02:00
b2/lang.y: don't pop fields from the stack before also handling the rule
This commit is contained in:
parent
4943519eb3
commit
a892b63d55
22
b2/lang.y
22
b2/lang.y
@ -50,14 +50,18 @@ static void push_field(const struct field *field)
|
||||
}
|
||||
|
||||
|
||||
static void pop_field(void)
|
||||
static void pop_fields(const struct field *last)
|
||||
{
|
||||
struct field_stack *entry;
|
||||
const struct field *popped;
|
||||
|
||||
assert(field_stack);
|
||||
entry = field_stack;
|
||||
field_stack = entry->next;
|
||||
free(entry);
|
||||
do {
|
||||
assert(field_stack);
|
||||
entry = field_stack;
|
||||
popped = entry->field;
|
||||
field_stack = entry->next;
|
||||
free(entry);
|
||||
} while (popped != last);
|
||||
}
|
||||
|
||||
|
||||
@ -241,7 +245,7 @@ rule:
|
||||
$$->any = $5;
|
||||
$$->next = NULL;
|
||||
field_finalize($$);
|
||||
pop_field();
|
||||
pop_fields($$);
|
||||
}
|
||||
;
|
||||
|
||||
@ -290,13 +294,14 @@ opt_wildcard:
|
||||
|
||||
action:
|
||||
{
|
||||
$<field>$ = (struct field *) top_field();
|
||||
push_field(top_field());
|
||||
}
|
||||
opt_fields opt_rule ';'
|
||||
{
|
||||
$$.fields = $2;
|
||||
$$.rules = $3;
|
||||
pop_field();
|
||||
pop_fields($<field>1);
|
||||
}
|
||||
;
|
||||
|
||||
@ -349,14 +354,13 @@ fields:
|
||||
}
|
||||
| field
|
||||
{
|
||||
$1->prev = top_field();
|
||||
push_field($1);
|
||||
}
|
||||
fields
|
||||
{
|
||||
$$ = $1;
|
||||
$$->next = $3;
|
||||
pop_field();
|
||||
$$->prev = top_field();
|
||||
if ($3)
|
||||
$3->prev = $1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user