From 9043278d44ff619e03bb6d2c87ac4e9b0f5aac60 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Thu, 25 Jul 2024 00:17:52 +0200 Subject: [PATCH] Fix non-K"Identifier" leafs in export lists --- 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 229cc62..826a593 100644 --- a/src/runestone.jl +++ b/src/runestone.jl @@ -974,7 +974,7 @@ function spaces_in_export_public(ctx::Context, node::Node) state = :expect_identifier elseif state === :expect_identifier state = :expect_comma - if kind(kid) in KSet"Identifier @ MacroName $" + if kind(kid) in KSet"Identifier @ MacroName $" || JuliaSyntax.is_operator(kid) any_changes && push!(kids′, kid) accept_node!(ctx, kid) if kind(kid) === K"@" diff --git a/test/runtests.jl b/test/runtests.jl index 3237004..ef9b102 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -840,6 +840,8 @@ end @test format_string(":(export \$a)") == ":(export \$a)" @test format_string("quote\nexport \$a, \$b\nend") == "quote\n export \$a, \$b\nend" @test_throws Exception format_string("export \$a") + # Non-identifiers + @test format_string("export ^") == "export ^" end @testset "parsing new syntax" begin