From 4927054b6074b50088d23a7c45ce73e800a1b0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Tue, 11 Jun 2024 05:14:22 +0500 Subject: [PATCH] Add "if" support --- src/compile.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/compile.c b/src/compile.c index 186b244..fa827a9 100644 --- a/src/compile.c +++ b/src/compile.c @@ -245,6 +245,25 @@ char* compile(tSyntaxElement* syntaxtree) { } 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) { string_append(&result, "{{");