File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -2882,10 +2882,16 @@ function parse_array_separator(ps, array_order)
28822882 k = kind (t)
28832883 if k == K " NewlineWs"
28842884 bump_trivia (ps)
2885- # Treat a linebreak prior to a value as a semicolon (ie, separator for
2886- # the first dimension) if no previous semicolons observed
2887- # [a \n b] ==> (vcat a b)
2888- return (1 , - 1 )
2885+ if peek (ps) == K " ]"
2886+ # Linebreaks not significant before closing `]`
2887+ # [a b\n\n] ==> (hcat a b)
2888+ return (typemin (Int), typemin (Int))
2889+ else
2890+ # Treat a linebreak prior to a value as a semicolon (ie, separator
2891+ # for the first dimension) if no previous semicolons observed
2892+ # [a \n b] ==> (vcat a b)
2893+ return (1 , - 1 )
2894+ end
28892895 elseif k == K " ,"
28902896 # Treat `,` as semicolon for the purposes of recovery
28912897 # [a; b, c] ==> (vcat a b (error-t) c)
Original file line number Diff line number Diff line change @@ -799,6 +799,8 @@ tests = [
799799 ((v= v " 1.7" ,), " [a b \n ;; c]" ) => " (ncat-2 (row a b (error-t)) c)"
800800 # Can't mix spaces and multiple ;'s
801801 ((v= v " 1.7" ,), " [a b ;; c]" ) => " (ncat-2 (row a b (error-t)) c)"
802+ # Linebreaks not significant before closing `]`
803+ " [a b\n\n ]" => " (hcat a b)"
802804 # Treat a linebreak prior to a value as a semicolon (ie, separator for
803805 # the first dimension) if no previous semicolons observed
804806 " [a \n b]" => " (vcat a b)"
You can’t perform that action at this time.
0 commit comments