Skip to content

Commit

Permalink
Locales are hard, sorry!
Browse files Browse the repository at this point in the history
Fixed #159
  • Loading branch information
Ratstail91 committed Dec 14, 2024
1 parent 7be63c8 commit 93fce94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion source/toy_value.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,10 @@ Toy_String* Toy_stringifyValue(Toy_Bucket** bucketHandle, Toy_Value value) {

//find the decimal, if it exists
unsigned int decimal = 0;
while (decimal != length && buffer[decimal] != '.') decimal++;
while (decimal != length && buffer[decimal] != '.' && buffer[decimal] != ',') decimal++; //'.' and ',' supports more locales

//locales are hard, sorry!
if (decimal != length && buffer[decimal] == ',') buffer[decimal] = '.';

//wipe the trailing zeros
while(decimal != length && buffer[length-1] == '0') buffer[--length] = '\0';
Expand Down
2 changes: 1 addition & 1 deletion source/toy_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ static void processIndex(Toy_VM* vm) {
}
else {
Toy_error("Incorrect number of elements found in index");
//URGENT: clear stack, then leave null
//TODO: clear stack, then leave null?
return;
}

Expand Down

0 comments on commit 93fce94

Please sign in to comment.