parsing bug fix

This commit is contained in:
Francesco Cozzuto
2022-04-15 18:56:09 +02:00
parent e60dfbd92a
commit 99b47fc824
+12 -3
View File
@@ -906,13 +906,16 @@ static Node *parse_map_primary_expression(Context *ctx)
if(done(ctx))
{
Error_Report(ctx->error, 0, "Source ended where a map literal was expected");
Error_Report(ctx->error, 0,
"Source ended where a map literal was expected");
return NULL;
}
if(current(ctx) != '{')
{
Error_Report(ctx->error, 0, "Got token \"%.*s\" where a map literal was expected", ctx->token->length, ctx->src + ctx->token->offset);
Error_Report(ctx->error, 0,
"Got token \"%.*s\" where a map literal was expected",
ctx->token->length, ctx->src + ctx->token->offset);
return NULL;
}
@@ -922,7 +925,13 @@ static Node *parse_map_primary_expression(Context *ctx)
Node *items = NULL;
int itemc = 0;
next(ctx); // Skip the '['.
next(ctx); // Skip the '{'.
if(done(ctx))
{
Error_Report(ctx->error, 0, "Source ended where a map child item's key was expected");
return NULL;
}
if(current(ctx) != '}')
{