From a8e4bfd264835c2819b2b97aae12d904d1929a56 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 17:33:41 +0500 Subject: [PATCH] Implement maps --- src/compile.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/compile.c b/src/compile.c index a68e90c..fced240 100644 --- a/src/compile.c +++ b/src/compile.c @@ -205,6 +205,21 @@ char* compile_expression(tSyntaxElement* syntaxelement) { string_append_free(&result,compile_gensplit(token, ",")); string_append(&result,"]"); + } else if (strcmp(token->content.string, "map") == 0) { + + string_append(&result,"{"); + for (tSyntaxElement* i = token->next; i != NULL; i = i->next) { + + string_append(&result, compile_expression(i->content.syntax)); + string_append(&result, ":"); + string_append(&result, compile_expression(i->content.syntax->next)); + + if (i->next != NULL) + string_append(&result,","); + + } + string_append(&result,"}"); + } else { string_append(&result,token->content.string);