Core: #compiler_breakpoint

This commit is contained in:
Krzosa Karol
2023-04-21 15:34:59 +02:00
parent 07dcb418dd
commit 108ec6121e
10 changed files with 27 additions and 15 deletions

View File

@@ -904,12 +904,11 @@ parse_decl(B32 is_global) {
Ast_Flag flags = 0;
Token *tname = token_get();
if (token_match(TK_Identifier, TK_DoubleColon)) {
if (token_match_pound(pctx->intern_foreign)) {
set_flag(flags, AST_FOREIGN);
}
else if (token_match_pound(pctx->intern_strict)) {
set_flag(flags, AST_STRICT);
for (;;) {
if (token_match_pound(pctx->intern_foreign)) set_flag(flags, AST_FOREIGN);
else if (token_match_pound(pctx->intern_strict)) set_flag(flags, AST_STRICT);
else if (token_match_pound(pctx->intern_compiler_breakpoint)) set_flag(flags, AST_COMPILER_BREAKPOINT);
else break;
}
if (token_match_keyword(pctx->keyword_struct)) {
@@ -973,6 +972,7 @@ parse_decl(B32 is_global) {
}
}
else if (token_match(TK_StringLit, TK_DoubleColon)) {
if (token_match_pound(pctx->intern_compiler_breakpoint)) set_flag(flags, AST_COMPILER_BREAKPOINT);
// @cleanup: consider simplifying lambdas, removing AST_LAMBDA_EXPR and
// implementing actual parse_lambda or something.
@@ -1013,13 +1013,17 @@ parse_decl(B32 is_global) {
set_flag_typespec(typespec);
Ast_Expr *expr = parse_assign_expr();
if (token_match_pound(pctx->intern_foreign))
set_flag(flags, AST_FOREIGN);
for (;;) {
if (token_match_pound(pctx->intern_foreign)) set_flag(flags, AST_FOREIGN);
else if (token_match_pound(pctx->intern_compiler_breakpoint)) set_flag(flags, AST_COMPILER_BREAKPOINT);
else break;
}
result = ast_var(tname, typespec, tname->intern_val, expr);
}
else if (token_match(TK_Identifier, TK_ColonAssign)) {
if (token_match_pound(pctx->intern_compiler_breakpoint)) set_flag(flags, AST_COMPILER_BREAKPOINT);
Ast_Expr *expr = parse_expr();
result = ast_var(tname, 0, tname->intern_val, expr);
}