Add if as an expression
This commit is contained in:
parent
d8636ace10
commit
e8ca2af9bc
@ -158,8 +158,23 @@ char* compile_expression(tSyntaxElement* syntaxelement) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
string_append(&result,token->content.string);
|
if (strcmp(token->content.string, "if") == 0) {
|
||||||
compile_genexec(&result, token);
|
|
||||||
|
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;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user