Merge pull request #6343 from krnowak/krnowak/package-docs

Kill deprecated file tags and fix assignment of package docs
This commit is contained in:
gingerBill
2026-03-03 12:29:35 +00:00
committed by GitHub

View File

@@ -1434,9 +1434,6 @@ gb_internal Token consume_comment(AstFile *f, isize *end_line_) {
if (end_line_) *end_line_ = end_line;
next_token0(f);
if (f->curr_token.pos.line > tok.pos.line || tok.kind == Token_EOF) {
end_line++;
}
return tok;
}
@@ -6728,11 +6725,6 @@ gb_internal bool parse_file(Parser *p, AstFile *f) {
String filepath = f->tokenizer.fullpath;
String base_dir = dir_from_path(filepath);
if (f->curr_token.kind == Token_Comment) {
consume_comment_groups(f, f->prev_token);
}
CommentGroup *docs = f->lead_comment;
Array<Token> tags = array_make<Token>(temporary_allocator());
bool first_invalid_token_set = false;
@@ -6754,6 +6746,8 @@ gb_internal bool parse_file(Parser *p, AstFile *f) {
}
}
CommentGroup *docs = f->lead_comment;
if (f->curr_token.kind != Token_package) {
ERROR_BLOCK();
@@ -6793,37 +6787,12 @@ gb_internal bool parse_file(Parser *p, AstFile *f) {
}
f->package_name = package_name.string;
{
if (docs != nullptr && docs->list.count > 0) {
for (Token const &tok : docs->list) {
GB_ASSERT(tok.kind == Token_Comment);
String str = tok.string;
if (!string_starts_with(str, str_lit("//"))) {
continue;
}
String lc = string_trim_whitespace(substring(str, 2, str.len));
if (string_starts_with(lc, str_lit("+"))) {
syntax_warning(tok, "'//+' is deprecated: Use '#+' instead");
String lt = substring(lc, 1, lc.len);
if (parse_file_tag(lt, tok, f) == false) {
return false;
}
}
}
}
for (Token const &tok : tags) {
GB_ASSERT(tok.kind == Token_FileTag);
String str = tok.string;
if (string_starts_with(str, str_lit("#+"))) {
String lt = string_trim_whitespace(substring(str, 2, str.len));
if (parse_file_tag(lt, tok, f) == false) {
return false;
}
}
for (Token const &tok : tags) {
GB_ASSERT(tok.kind == Token_FileTag);
GB_ASSERT(string_starts_with(tok.string, str_lit("#+")));
String lt = string_trim_whitespace(substring(tok.string, 2, tok.string.len));
if (parse_file_tag(lt, tok, f) == false) {
return false;
}
}