Do not add spaces between dots.

This commit is contained in:
bʰedoh₂ swé 2025-01-29 20:23:58 +05:00
parent cfea07531d
commit 9bb5280c44

View File

@ -136,7 +136,7 @@ void compile_genexec(char** result, tSyntaxElement* se){
string_append(result,")"); string_append(result,")");
} }
char* compile_gensplit(tSyntaxElement* se, char* operator) { char* compile_gensplit(tSyntaxElement* se, char* operator, bool dosplit) {
tSyntaxElement* token = se; tSyntaxElement* token = se;
char* result = malloc(sizeof(char)); char* result = malloc(sizeof(char));
result[0] = '\0'; result[0] = '\0';
@ -151,8 +151,10 @@ char* compile_gensplit(tSyntaxElement* se, char* operator) {
if (token->next->next != NULL) { if (token->next->next != NULL) {
if (dosplit)
string_append(&result," "); string_append(&result," ");
string_append(&result,operator); string_append(&result,operator);
if (dosplit)
string_append(&result," "); string_append(&result," ");
} }
@ -198,7 +200,7 @@ char* compile_expression(tSyntaxElement* syntaxelement) {
char* operator = token->content.string; char* operator = token->content.string;
string_append_free(&result, compile_gensplit(token, operator)); string_append_free(&result, compile_gensplit(token, operator, !!strcmp(".", token->content.string)));
} else { } else {
@ -232,13 +234,13 @@ char* compile_expression(tSyntaxElement* syntaxelement) {
} else if (strcmp(token->content.string, "list") == 0) { } else if (strcmp(token->content.string, "list") == 0) {
string_append(&result,"["); string_append(&result,"[");
string_append_free(&result,compile_gensplit(token, ",")); string_append_free(&result,compile_gensplit(token, ",", true));
string_append(&result,"]"); string_append(&result,"]");
} else if (strcmp(token->content.string, "range") == 0) { } else if (strcmp(token->content.string, "range") == 0) {
string_append(&result,"["); string_append(&result,"[");
string_append_free(&result,compile_gensplit(token, "..")); string_append_free(&result,compile_gensplit(token, "..", true));
string_append(&result,"]"); string_append(&result,"]");
} else if (strcmp(token->content.string, "map") == 0) { } else if (strcmp(token->content.string, "map") == 0) {