Add "filter"

This commit is contained in:
bʰedoh₂ swé 2024-06-11 19:10:46 +05:00
parent 5edcf05d7a
commit 13bb7399aa

View File

@ -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, "{#");