@@ -2673,13 +2673,13 @@ end
2673
2673
# power of 0 for whitespace and negative numbers for other separators.
2674
2674
#
2675
2675
# FIXME : Error messages for mixed spaces and ;; delimiters
2676
- function parse_array_separator (ps)
2677
- t = peek_token (ps)
2676
+ function parse_array_separator (ps; skip_newlines = false )
2677
+ t = peek_token (ps; skip_newlines = skip_newlines )
2678
2678
k = kind (t)
2679
2679
if k == K " ;"
2680
2680
n_semis = 1
2681
2681
while true
2682
- bump (ps, TRIVIA_FLAG)
2682
+ bump (ps, TRIVIA_FLAG; skip_newlines = skip_newlines )
2683
2683
t = peek_token (ps)
2684
2684
if kind (t) != K " ;" || t. had_whitespace
2685
2685
break
@@ -2722,11 +2722,18 @@ function parse_cat(ps::ParseState, closer, end_is_symbol)
2722
2722
whitespace_newline= false ,
2723
2723
for_generator= true )
2724
2724
k = peek (ps, skip_newlines= true )
2725
+ mark = position (ps)
2725
2726
if k == closer
2726
2727
# [] ==> (vect)
2727
2728
return parse_vect (ps, closer)
2729
+ elseif k == K " ;"
2730
+ # [;;] ==> (ncat 2)
2731
+ # [;; \n ] ==> (ncat 2)
2732
+ n_semis, _ = parse_array_separator (ps; skip_newlines= true )
2733
+ bump_closing_token (ps, closer)
2734
+ min_supported_version (v " 1.8" , ps, mark, " empty multidimensional array syntax" )
2735
+ return (K " ncat" , set_numeric_flags (n_semis))
2728
2736
end
2729
- mark = position (ps)
2730
2737
parse_eq_star (ps)
2731
2738
k = peek (ps, skip_newlines= true )
2732
2739
if k == K " ," || k == closer
0 commit comments