diff options
author | Maria Matejka <mq@ucw.cz> | 2022-11-07 10:28:01 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-11-07 10:28:01 +0100 |
commit | 7bbd0b5a3b670cfbe72df21054465b71a632962f (patch) | |
tree | 5b1ca17e997224af1f5837b5ef2b1900366ea1dd /filter | |
parent | 40bae8e1b788a535466ac673629fc93b6a258576 (diff) | |
parent | 37b644413723670928f6b54f2abe0c852eb0b652 (diff) |
Merge commit '37b64441' into thread-next
Diffstat (limited to 'filter')
-rw-r--r-- | filter/config.Y | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/filter/config.Y b/filter/config.Y index 5ba4f7e6..d20e4a04 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -38,9 +38,9 @@ f_new_var(struct sym_scope *s) /* * - A variable is an offset on vstack from vbase. * - Vbase is set on filter start / function call. - * - Scopes contain anonymous scopes (blocks) inside filter/function scope + * - Scopes contain (non-frame) block scopes inside filter/function scope * - Each scope knows number of vars in that scope - * - Offset is therefore a sum of 'slots' up to named scope + * - Offset is therefore a sum of 'slots' up to filter/function scope * - New variables are added on top of vstk, so intermediate values cannot * be there during FI_VAR_INIT. I.e. no 'var' inside 'term'. * - Also, each f_line must always have its scope, otherwise a variable may @@ -49,7 +49,7 @@ f_new_var(struct sym_scope *s) int offset = s->slots++; - while (!s->name) + while (s->block) { s = s->next; ASSERT(s); @@ -491,10 +491,12 @@ filter: cf_assert_symbol($1, SYM_FILTER); $$ = $1->filter; } - | filter_body { + | { cf_push_scope(NULL); } filter_body { struct filter *f = cfg_alloc(sizeof(struct filter)); - *f = (struct filter) { .root = $1 }; + *f = (struct filter) { .root = $2 }; $$ = f; + + cf_pop_scope(); } ; @@ -937,13 +939,13 @@ cmd: } | FOR { /* Reserve space for walk data on stack */ - cf_push_scope(NULL); + cf_push_block_scope(); conf_this_scope->slots += 2; } for_var IN /* Parse term in the parent scope */ { conf_this_scope->active = 0; } term { conf_this_scope->active = 1; } DO cmd { - cf_pop_scope(); + cf_pop_block_scope(); $$ = f_new_inst(FI_FOR_INIT, $6, $3); $$->next = f_new_inst(FI_FOR_NEXT, $3, $9); } |