Implement maps

This commit is contained in:
bʰedoh₂ swé 2024-06-11 17:33:41 +05:00
parent 834ec9d3d4
commit a8e4bfd264

View File

@ -205,6 +205,21 @@ char* compile_expression(tSyntaxElement* syntaxelement) {
string_append_free(&result,compile_gensplit(token, ",")); string_append_free(&result,compile_gensplit(token, ","));
string_append(&result,"]"); 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 { } else {
string_append(&result,token->content.string); string_append(&result,token->content.string);