stage1 整理代码 修复错误

This commit is contained in:
zzy
2026-07-21 20:00:19 +08:00
parent 7c5bb41e09
commit a2d5dd9ce8
9 changed files with 79 additions and 85 deletions

View File

@@ -991,7 +991,20 @@ void spl_parse_stmt(spl_comp_t *ctx) {
case TOK_LINE_COMMENT:
advance(ctx);
break;
case TOK_AT: /* @extern(...) */
case TOK_AT: { /* @extern(...) or @dbg/@@sizeof expression */
usize saved = ctx->tok_idx;
advance(ctx); /* @ */
skip_nl(ctx);
spl_tok_t *t = peek(ctx);
if (t && t->type == KW_EXTERN) {
ctx->tok_idx = saved;
parse_extern_decl(ctx);
} else {
ctx->tok_idx = saved;
parse_expr_stmt(ctx);
}
break;
}
case TOK_SHARP: /* #[extern(...)] (legacy) */
parse_extern_decl(ctx);
break;