Core: Add Ast_Label
This commit is contained in:
@@ -293,7 +293,7 @@ parse_stmt_scope(Ast_Scope *scope_defined_outside = 0) {
|
||||
scope->stmts.add(ast_continue(token));
|
||||
}
|
||||
|
||||
else if (token_match_keyword(pctx->keyword___compilerbreakpoint)) {
|
||||
else if (token_match_keyword(pctx->intern_compiler_breakpoint)) {
|
||||
scope->stmts.add(ast_compiler_breakpoint(token));
|
||||
}
|
||||
|
||||
@@ -423,6 +423,21 @@ parse_stmt_scope(Ast_Scope *scope_defined_outside = 0) {
|
||||
scope->stmts.add(result_if);
|
||||
}
|
||||
|
||||
// Label
|
||||
else if (token_match(TK_Colon)) {
|
||||
Token *ident = token_expect(TK_Identifier);
|
||||
Token *enable_goto_token = token_match(TK_Colon);
|
||||
bool enable_goto = enable_goto_token ? 1 : 0;
|
||||
Token *breakpoint = token_match_pound(pctx->intern_compiler_breakpoint);
|
||||
|
||||
Ast_Scope *s = 0;
|
||||
if (token_is(OPEN_SCOPE)) s = parse_stmt_scope();
|
||||
|
||||
Ast_Label *result = ast_label(token, ident->intern_val, s, enable_goto);
|
||||
if (breakpoint) set_flag(result->flags, AST_COMPILER_BREAKPOINT);
|
||||
scope->stmts.add(result);
|
||||
}
|
||||
|
||||
// Var unpack
|
||||
else if (token_is(TK_Identifier) && token_is(TK_Comma, 1)) {
|
||||
Array<Ast_Decl *> decls = {scratch.arena};
|
||||
|
||||
Reference in New Issue
Block a user