Skip to content

Commit

Permalink
Fix handling of inline comments in export/public expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Jul 26, 2024
1 parent c19f5b5 commit 49e6c9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/runestone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down

0 comments on commit 49e6c9d

Please sign in to comment.