From 9b605597b2d00375caa785e3a9fb6d993e368203 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 20:38:19 +0500 Subject: [PATCH] Add "is" --- src/compile.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/compile.c b/src/compile.c index fe3bf47..63c6290 100644 --- a/src/compile.c +++ b/src/compile.c @@ -247,6 +247,52 @@ char* compile_expression(tSyntaxElement* syntaxelement) { string_append(&result,"}"); + } else if (strcmp(token->content.string, "isnull") == 0) { + + string_append_free(&result, compile_expression_wrapped(token->next)); + string_append(&result, " is null"); + + } else if (strcmp(token->content.string, "notnull") == 0) { + + string_append_free(&result, compile_expression_wrapped(token->next)); + string_append(&result, " is not null"); + + } else if (strcmp(token->content.string, "same") == 0) { + + string_append_free(&result, compile_expression_wrapped(token->next)); + string_append(&result, " is same as "); + string_append_free(&result, compile_expression_wrapped(token->next->next)); + + } else if (strcmp(token->content.string, "diff") == 0) { + + string_append_free(&result, compile_expression_wrapped(token->next)); + string_append(&result, " is not same as "); + string_append_free(&result, compile_expression_wrapped(token->next->next)); + + } else if (strcmp(token->content.string, "isdiv") == 0) { + + string_append_free(&result, compile_expression_wrapped(token->next)); + string_append(&result, " is divisible by "); + string_append_free(&result, compile_expression_wrapped(token->next->next)); + + } else if (strcmp(token->content.string, "notdiv") == 0) { + + string_append_free(&result, compile_expression_wrapped(token->next)); + string_append(&result, " is divisible by "); + string_append_free(&result, compile_expression_wrapped(token->next->next)); + + } else if (strcmp(token->content.string, "is") == 0) { + + string_append_free(&result, compile_expression_wrapped(token->next)); + string_append(&result, " is "); + string_append_free(&result, compile_expression(token->next->next)); + + } else if (strcmp(token->content.string, "not") == 0) { + + string_append_free(&result, compile_expression_wrapped(token->next)); + string_append(&result, " is not "); + string_append_free(&result, compile_expression(token->next->next)); + } else { string_append(&result,token->content.string);