From 13bb7399aa36b375ce3bb2c4ce03333cdb071e10 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 19:10:46 +0500 Subject: [PATCH] Add "filter" --- src/compile.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/compile.c b/src/compile.c index 2a1e005..2399cb5 100644 --- a/src/compile.c +++ b/src/compile.c @@ -370,6 +370,23 @@ char* compile(tSyntaxElement* syntaxtree) { compile_exit_tag(&result); + } else if (strcmp(token->content.string, "filter") == 0) { + + compile_enter_tag(&result); + + string_append(&result, "filter "); + string_append_free(&result,compile_expression(token->next)); + + compile_exit_tag(&result); + + string_append_free(&result,compile(token->next->next)); + + compile_enter_tag(&result); + + string_append(&result, "endfilter"); + + compile_exit_tag(&result); + } else if (strcmp(token->content.string, "print") == 0) { for(tSyntaxElement* i = token->next; i != NULL; i = i->next) { @@ -487,6 +504,13 @@ char* compile(tSyntaxElement* syntaxtree) { string_append_free(&result, compile_expression(token->next->next)); compile_exit_tag(&result); + } else if (strcmp(token->content.string, "quote") == 0) { + + if (token->next->type == STRING) + string_append(&result,token->next->content.string); + else + string_append_free(&result,compile_expression(token->next)); + } else { string_append(&result, "{#");