Skip to content

Commit 7eb386d

Browse files
committed
fix expr parsing in brackets
1 parent b518423 commit 7eb386d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/components/operators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ function parse_unary_colon(ps::ParseState, op::EXPR)
243243
ret = op
244244
else
245245
prev_errored = ps.errored
246-
arg = @precedence ps 20 parse_expression(ps)
246+
arg = @precedence ps 20 @nocloser ps :inref parse_expression(ps)
247247
if isbracketed(arg) && headof(arg.args[1]) === :errortoken && errorof(arg.args[1]) === UnexpectedAssignmentOp
248248
ps.errored = prev_errored
249249
arg.args[1] = arg.args[1].args[1]

test/parser.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,4 +1270,23 @@ end
12701270
@test test_expr("0x111111111111111111111111111111111")
12711271
end
12721272
end
1273+
1274+
@testset "#302" begin
1275+
str = """
1276+
const _examples = PlotExample[
1277+
PlotExample( # 1
1278+
"Lines",
1279+
"A simple line plot of the columns.",
1280+
[:(
1281+
begin
1282+
plot(Plots.fakedata(50, 5), w = 3)
1283+
end
1284+
)],
1285+
),
1286+
]
1287+
"""
1288+
@test test_expr(str)
1289+
x, ps = CSTParser.parse(CSTParser.ParseState(str), true)
1290+
@test ps.errored == false
1291+
end
12731292
end

0 commit comments

Comments
 (0)