From 49e6c9dc5397188c1bf4ed1926deb1f981f3ea06 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sat, 27 Jul 2024 00:40:41 +0200 Subject: [PATCH] Fix handling of inline comments in export/public expressions --- src/runestone.jl | 2 +- test/runtests.jl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runestone.jl b/src/runestone.jl index c8de53e..327137d 100644 --- a/src/runestone.jl +++ b/src/runestone.jl @@ -986,7 +986,7 @@ function spaces_in_export_public(ctx::Context, node::Node) elseif kind(kid) in KSet"Comment NewlineWs" any_changes && push!(kids′, kid) accept_node!(ctx, kid) - state = :expect_identifier + state = :expect_space else @assert false end diff --git a/test/runtests.jl b/test/runtests.jl index dd0cd04..d909561 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -850,6 +850,8 @@ end @test format_string("$(verb) $(a)$(sp),\n$(b)") == "$(verb) $(a),\n $(b)" @test format_string("$(verb) \n$(a)$(sp),\n$(b)") == "$(verb)\n $(a),\n $(b)" @test format_string("$(verb) $(a)$(sp),\n# b\n$(b)") == "$(verb) $(a),\n # b\n $(b)" + # Inline comments + @test format_string("export a$(sp),$(sp)#= b, =#$(sp)c") == "export a, #= b, =# c" end # Interpolated identifiers (currently only expected in K"quote" and K"macrocall") @test format_string(":(export \$a)") == ":(export \$a)"