static void flush_stored_tags(OnyxParser *parser, bh_arr(AstTyped *) *out_arr) {
//
- // When inside_tag is true, no tags will be added to the element.
+ // When tag_depth > 0, no tags will be added to the element.
// This happens if you have a something like so,
//
// #tag "asdf"
// In this situation, the inner procedure defined in the second
// tag should NOT consume the "asdf" tag.
//
- if (bh_arr_length(parser->stored_tags) == 0 || parser->inside_tag) return;
+ if (bh_arr_length(parser->stored_tags) == 0 || parser->tag_depth > 0) return;
bh_arr(AstTyped *) arr = *out_arr;
while (parse_possible_directive(parser, "tag")) {
if (meta_tags == NULL) bh_arr_new(global_heap_allocator, meta_tags, 1);
- parser->inside_tag = 1;
+ parser->tag_depth += 1;
do {
AstTyped* expr = parse_expression(parser, 0);
bh_arr_push(meta_tags, expr);
} while (consume_token_if_next(parser, ','));
- parser->inside_tag = 0;
+ parser->tag_depth -= 1;
}
member_is_used = consume_token_if_next(parser, Token_Type_Keyword_Use);
return;
}
else if (parse_possible_directive(parser, "tag")) {
- parser->inside_tag = 1;
+ parser->tag_depth += 1;
AstTyped *expr = parse_expression(parser, 0);
bh_arr_push(parser->stored_tags, expr);
- parser->inside_tag = 0;
+ parser->tag_depth -= 1;
return;
}
else {
parser.scope_flags = NULL;
parser.stored_tags = NULL;
parser.parse_calls = 1;
+ parser.tag_depth = 0;
parser.polymorph_context = (PolymorphicContext) {
.root_node = NULL,