Add "if" support
This commit is contained in:
parent
07f9a6abd8
commit
4927054b60
@ -245,6 +245,25 @@ char* compile(tSyntaxElement* syntaxtree) {
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
|
if (strcmp(token->content.string, "if") == 0) {
|
||||||
|
|
||||||
|
compile_enter_tag(&result);
|
||||||
|
|
||||||
|
string_append(&result, "if ");
|
||||||
|
string_append(&result,compile_expression(token->next));
|
||||||
|
|
||||||
|
compile_exit_tag(&result);
|
||||||
|
|
||||||
|
string_append(&result,compile(token->next->next));
|
||||||
|
|
||||||
|
compile_enter_tag(&result);
|
||||||
|
|
||||||
|
string_append(&result, "endif");
|
||||||
|
|
||||||
|
compile_exit_tag(&result);
|
||||||
|
|
||||||
|
} else
|
||||||
|
|
||||||
if (strcmp(token->content.string, "print") == 0) {
|
if (strcmp(token->content.string, "print") == 0) {
|
||||||
|
|
||||||
string_append(&result, "{{");
|
string_append(&result, "{{");
|
||||||
|
Loading…
Reference in New Issue
Block a user