mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
parse_file: Removed some nesting and removed probable incorrect safety check.
This commit is contained in:
+6
-11
@@ -6452,14 +6452,6 @@ gb_internal bool parse_file(Parser *p, AstFile *f) {
|
|||||||
if (f->package_token.kind != Token_package) {
|
if (f->package_token.kind != Token_package) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (docs != nullptr) {
|
|
||||||
TokenPos end = token_pos_end(docs->list[docs->list.count-1]);
|
|
||||||
if (end.line == f->package_token.pos.line || end.line+1 == f->package_token.pos.line) {
|
|
||||||
// Okay
|
|
||||||
} else {
|
|
||||||
docs = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Token package_name = expect_token_after(f, Token_Ident, "package");
|
Token package_name = expect_token_after(f, Token_Ident, "package");
|
||||||
if (package_name.kind == Token_Ident) {
|
if (package_name.kind == Token_Ident) {
|
||||||
@@ -6478,10 +6470,14 @@ gb_internal bool parse_file(Parser *p, AstFile *f) {
|
|||||||
for (Token const &tok : docs->list) {
|
for (Token const &tok : docs->list) {
|
||||||
GB_ASSERT(tok.kind == Token_Comment);
|
GB_ASSERT(tok.kind == Token_Comment);
|
||||||
String str = tok.string;
|
String str = tok.string;
|
||||||
if (string_starts_with(str, str_lit("//"))) {
|
|
||||||
|
if (!string_starts_with(str, str_lit("//"))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String lc = string_trim_whitespace(substring(str, 2, str.len));
|
String lc = string_trim_whitespace(substring(str, 2, str.len));
|
||||||
if (string_starts_with(lc, str_lit("+"))) {
|
if (string_starts_with(lc, str_lit("+"))) {
|
||||||
//syntax_warning(tok, "'//+' is deprecated: Use '#+' instead");
|
syntax_warning(tok, "'//+' is deprecated: Use '#+' instead");
|
||||||
String lt = substring(lc, 1, lc.len);
|
String lt = substring(lc, 1, lc.len);
|
||||||
if (parse_file_tag(lt, tok, f) == false) {
|
if (parse_file_tag(lt, tok, f) == false) {
|
||||||
return false;
|
return false;
|
||||||
@@ -6489,7 +6485,6 @@ gb_internal bool parse_file(Parser *p, AstFile *f) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (Token const &tok : tags) {
|
for (Token const &tok : tags) {
|
||||||
GB_ASSERT(tok.kind == Token_FileTag);
|
GB_ASSERT(tok.kind == Token_FileTag);
|
||||||
|
|||||||
Reference in New Issue
Block a user