mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-30 18:02:02 +00:00
Change procedure group syntax from proc[] to proc{}; deprecate proc[] (raises warning currently)
This commit is contained in:
@@ -1742,8 +1742,31 @@ Ast *parse_operand(AstFile *f, bool lhs) {
|
||||
case Token_proc: {
|
||||
Token token = expect_token(f, Token_proc);
|
||||
|
||||
if (f->curr_token.kind == Token_OpenBracket) { // ProcGroup
|
||||
if (f->curr_token.kind == Token_OpenBrace) { // ProcGroup
|
||||
Token open = expect_token(f, Token_OpenBrace);
|
||||
|
||||
auto args = array_make<Ast *>(heap_allocator());
|
||||
|
||||
while (f->curr_token.kind != Token_CloseBrace &&
|
||||
f->curr_token.kind != Token_EOF) {
|
||||
Ast *elem = parse_expr(f, false);
|
||||
array_add(&args, elem);
|
||||
|
||||
if (!allow_token(f, Token_Comma)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Token close = expect_token(f, Token_CloseBrace);
|
||||
|
||||
if (args.count == 0) {
|
||||
syntax_error(token, "Expected a least 1 argument in a procedure group");
|
||||
}
|
||||
|
||||
return ast_proc_group(f, token, open, close, args);
|
||||
} else if (f->curr_token.kind == Token_OpenBracket) { // ProcGroup
|
||||
Token open = expect_token(f, Token_OpenBracket);
|
||||
warning(open, "Procedure groups using [] are now deprecated, please use {} instead");
|
||||
|
||||
auto args = array_make<Ast *>(heap_allocator());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user