Fix a bunch of ifdirective related issues in Ink. Load the UI rect shader in ensom.

This commit is contained in:
2025-10-01 21:43:52 +02:00
parent 39d2fe6ad0
commit afced44abe
16 changed files with 172 additions and 152 deletions

View File

@@ -1200,39 +1200,43 @@ field_list :: (parse_state : *Parser, separator : Separator_Type, require_field_
source_location.begin = parse_state.previous;
source_location.main_token = parse_state.current;
while check(parse_state, .TOKEN_IDENTIFIER) {
field : *AST_Node;
identifier := parse_state.current;
advance(parse_state);
if require_field_names || check(parse_state, .TOKEN_COLON) {
field = field_declaration(parse_state, identifier);
} else {
field = make_node(parse_state, .Unnamed_Field);
while check(parse_state, .TOKEN_IDENTIFIER) || (check(parse_state, .TOKEN_DIRECTIVE) || parse_state.current.ident_value == "if") {
if check(parse_state, .TOKEN_IDENTIFIER) {
field : *AST_Node;
identifier := parse_state.current;
advance(parse_state);
if require_field_names || check(parse_state, .TOKEN_COLON) {
field = field_declaration(parse_state, identifier);
} else {
field = make_node(parse_state, .Unnamed_Field);
source_location : Source_Range;
source_location.begin = identifier;
source_location : Source_Range;
source_location.begin = identifier;
source_location.main_token = identifier;
field.name = identifier.ident_value;
field.token = identifier;
}
add_child(node, field);
source_location.main_token = identifier;
field.name = identifier.ident_value;
field.token = identifier;
}
add_child(node, field);
if check(parse_state, .TOKEN_RIGHTPAREN) {
source_location.end = parse_state.current;
node.source_location = source_location;
return node;
}
if separator == {
case .Comma; {
consume(parse_state, .TOKEN_COMMA, "Expect ',' after field declaration.");
if check(parse_state, .TOKEN_RIGHTPAREN) {
source_location.end = parse_state.current;
node.source_location = source_location;
return node;
}
case .Semicolon; {
consume(parse_state, .TOKEN_SEMICOLON, "Expect ';' after field declaration.");
if separator == {
case .Comma; {
consume(parse_state, .TOKEN_COMMA, "Expect ',' after field declaration.");
}
case .Semicolon; {
consume(parse_state, .TOKEN_SEMICOLON, "Expect ';' after field declaration.");
}
}
}
} else if check(parse_state, .TOKEN_DIRECTIVE) || parse_state.current.ident_value == "if" {
dir := directive(parse_state);
add_child(node, dir);
}
}
return node;