Skip to content

Commit 9e49373

Browse files
committed
fix multiline parser map
1 parent 0bf0407 commit 9e49373

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/interpreter/parser.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -834,11 +834,10 @@ static Expr *list(Parser *parser)
834834
ListExpr *expr = (ListExpr *)expr_alloc(parser->ast_arena, EXPR_LIST, parser->source_line);
835835

836836
/* if next is not ']', parse list initializer */
837-
if (!match(parser, t_rbracket)) {
837+
if (!match(parser, t_rbracket))
838838
expr->exprs = sequence(parser, t_rbracket);
839-
} else {
839+
else
840840
expr->exprs = NULL;
841-
}
842841

843842
return (Expr *)expr;
844843
}
@@ -858,11 +857,13 @@ static Expr *map(Parser *parser)
858857
do {
859858
KeyValuePair *pair = m_arena_alloc_struct(parser->ast_arena, KeyValuePair);
860859
pair->key = expression(parser);
861-
consume(parser, t_colon, "Expected colon ':' to denote value for key in map expression");
860+
consume(parser, t_colon, "Expected ':' to denote value for key in map expression");
862861
pair->value = expression(parser);
863862
arena_ll_append(expr->key_value_pairs, pair);
863+
ignore(parser, t_newline);
864864
if (!match(parser, t_comma))
865865
break;
866+
ignore(parser, t_newline);
866867
} while (!check(parser, t_rbracket));
867868

868869
consume(parser, t_rbracket, "Expected ']' to terminate map");

0 commit comments

Comments
 (0)