Allow trailing commas when writing a compound

This commit is contained in:
2023-08-04 18:43:07 +10:00
parent 64944c24f6
commit 3783c94064
3 changed files with 13 additions and 0 deletions

View File

@@ -168,6 +168,10 @@ static Toy_Opcode compound(Toy_Parser* parser, Toy_ASTNode** nodeHandle) {
consume(parser, TOY_TOKEN_COMMA, "Expected ',' in array or dictionary");
}
if (match(parser, TOY_TOKEN_BRACKET_RIGHT)) { //allow for trailing commas
break;
}
iterations++;
Toy_ASTNode* left = NULL;