Skip to content

Commit 36c5005

Browse files
committed
fix error handling?
1 parent c48113f commit 36c5005

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/components/lists.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ function parse_array(ps::ParseState, isref = false)
9494
end
9595
else
9696
ret = parse_array_outer(ps::ParseState, trivia, isref)
97-
9897
pushtotrivia!(ret, accept_rsquare(ps))
98+
9999
return ret
100100
end
101101
end
@@ -117,7 +117,7 @@ function parse_array_outer(ps::ParseState, trivia, isref)
117117
min_bp = 0
118118
is_start = true
119119
while kindof(ps.nt) !== Tokens.RSQUARE && kindof(ps.nt) !== Tokens.ENDMARKER
120-
a = @nocloser ps :newline @closesquare ps @closer ps :insquare @closer ps :ws @closer ps :wsop @closer ps :comma parse_expression(ps)
120+
a = @nocloser ps :newline @nocloser ps :newline @closesquare ps @closer ps :insquare @closer ps :ws @closer ps :wsop @closer ps :comma parse_expression(ps)
121121

122122
if is_start
123123
args = EXPR[]
@@ -164,7 +164,13 @@ function parse_array_outer(ps::ParseState, trivia, isref)
164164
end
165165
end
166166

167-
ret = _process_inner_array(args_list, trivia_bp)
167+
168+
if length(trivia_bp) + 1 < length(args_list)
169+
return EXPR(:errortoken, args_list, trivia)
170+
else
171+
ret = _process_inner_array(args_list, trivia_bp)
172+
end
173+
168174
for t in trivia
169175
pushtotrivia!(ret, t)
170176
end

0 commit comments

Comments
 (0)