File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ function parse_tuple(ps::ParseState, ret::EXPR)
46
46
end
47
47
48
48
# XXX : Avert thine eyes.
49
- function count_semicolons (ps)
49
+ function count_semicolons (ps, check_newline = true )
50
50
dims = 0
51
51
has_newline = false
52
52
old_pos = position (ps. l. io)
@@ -55,7 +55,7 @@ function count_semicolons(ps)
55
55
c = readchar (ps. l. io)
56
56
if c == ' ;'
57
57
dims += 1
58
- elseif c == ' \n '
58
+ elseif check_newline && c == ' \n '
59
59
# technically, only trailing newlines are allowed; we're a bit more lenient here
60
60
has_newline = true
61
61
else
@@ -82,7 +82,7 @@ function parse_array(ps::ParseState, isref = false)
82
82
if kindof (ps. nt) === Tokens. RSQUARE
83
83
dims = 0
84
84
if kindof (ps. ws) == SemiColonWS
85
- dims = count_semicolons (ps)
85
+ dims = count_semicolons (ps, false )
86
86
end
87
87
push! (trivia, accept_rsquare (ps))
88
88
if dims > 0
Original file line number Diff line number Diff line change 496
496
@testset " ncat" begin
497
497
@test " [;]" |> test_expr
498
498
@test " [;;]" |> test_expr
499
+ @test " [;;\n ]" |> test_expr
500
+ @test " [\n ;; \n ]" |> test_expr
499
501
@test " [;;;;;;;]" |> test_expr
500
502
@test " [x;;;;;]" |> test_expr
501
503
@test " [x;;]" |> test_expr
You can’t perform that action at this time.
0 commit comments