A bunch of array fixes and some buffer stuff that doesn't quite work yet

This commit is contained in:
2025-09-24 14:04:50 +02:00
parent 50a404984d
commit 940b58331d
18 changed files with 261 additions and 137 deletions

View File

@@ -1368,8 +1368,35 @@ function_declaration :: (parse_state : *Parse_State, identifier_token : *Token,
}
buffer :: (state : *Parse_State, identifier_token : *Token = null) -> *AST_Node {
internal_error_message(*state.ctx.messages, "Buffers are not yet implemented in the language.", state.ctx.file.path);
return null;
node : *AST_Node = make_node(state, .Buffer);
source_location : Source_Range;
source_location.begin = state.current;
if check(state, .TOKEN_AT) {
while check(state, .TOKEN_AT) {
advance(state);
// @Incomplete(niels): this is a mapping
if check(state, .TOKEN_IDENTIFIER) {
array_add(*node.hint_tokens, state.current);
advance(state);
}
}
}
consume(state, .TOKEN_LEFTBRACE, "Expect '{' after 'buffer' keyword");
buffer := field_list(state, .Semicolon);
node.array_field = true;
if identifier_token {
node.name = identifier_token.ident_value;
}
add_child(node, buffer);
consume(state, .TOKEN_RIGHTBRACE, "Expect '}' after 'buffer' block");
source_location.end = state.previous;
node.source_location = source_location;
return node;
}
constant_buffer :: (parse_state : *Parse_State, identifier_token : *Token = null) -> *AST_Node {
@@ -1484,7 +1511,7 @@ declaration :: (parse_state : *Parse_State) -> *AST_Node {
error := error_node(parse_state, tprint("Expected a declaration or function call. '%' not allowed as a declaration name.", parse_state.current.kind));
advance(parse_state);
decl_node = error;
}
}
if !decl_node && !skip_statement {
decl_node = statement(parse_state);