Skip to content

Commit

Permalink
Forbid parsing more fields if no separator was found
Browse files Browse the repository at this point in the history
  • Loading branch information
Feoramund committed Sep 20, 2024
1 parent a4dd489 commit 84700e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4377,10 +4377,14 @@ gb_internal Ast *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_fl
}
}

allow_field_separator(f);
bool more_fields = allow_field_separator(f);
Ast *param = ast_field(f, names, type, default_value, set_flags, tag, docs, f->line_comment);
array_add(&params, param);

if (!more_fields) {
if (name_count_) *name_count_ = total_name_count;
return ast_field_list(f, start_token, params);
}

while (f->curr_token.kind != follow &&
f->curr_token.kind != Token_EOF &&
Expand Down

0 comments on commit 84700e0

Please sign in to comment.