Skip to content

Commit 20134c3

Browse files
committed
Fix parsing of broken syntax [x
1 parent 21c28a9 commit 20134c3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/parser.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2781,9 +2781,10 @@ function parse_cat(ps::ParseState, closer, end_is_symbol)
27812781
end
27822782
parse_eq_star(ps)
27832783
k = peek(ps, skip_newlines=true)
2784-
if k == K"," || k == closer
2784+
if k == K"," || (is_closing_token(ps, k) && k != K";")
27852785
if k == K","
27862786
# [x,] ==> (vect x)
2787+
# [x ==> (vect x)
27872788
bump(ps, TRIVIA_FLAG)
27882789
end
27892790
# [x] ==> (vect x)

test/parser.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ tests = [
581581
"[]" => "(vect)"
582582
"[x,]" => "(vect x)"
583583
"[x]" => "(vect x)"
584+
"[x" => "(vect x (error-t))"
584585
"[x \n ]" => "(vect x)"
585586
"[x \n\n ]" => "(vect x)"
586587
"[x for a in as]" => "(comprehension (generator x (= a as)))"

0 commit comments

Comments
 (0)