Add if as an expression

This commit is contained in:
bʰedoh₂ swé 2024-06-11 05:32:55 +05:00
parent d8636ace10
commit e8ca2af9bc

View File

@ -158,10 +158,25 @@ char* compile_expression(tSyntaxElement* syntaxelement) {
} else {
if (strcmp(token->content.string, "if") == 0) {
string_append(&result,compile_expression_wrapped(token->next));
string_append(&result,"?");
string_append(&result,compile_expression_wrapped(token->next->next));
string_append(&result,":");
string_append(&result,compile_expression_wrapped(token->next->next->next));
}
else {
string_append(&result,token->content.string);
compile_genexec(&result, token);
}
}
break;
}