From 2ce46aa355bc6b3bbb8c834e2a7efaa878ca91ca Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Mon, 8 Jul 2024 14:13:01 +0200 Subject: [PATCH] Fix nested module indent with var"..." as module name --- src/runestone.jl | 2 +- test/runtests.jl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runestone.jl b/src/runestone.jl index 9fa7d7d..75dfeaa 100644 --- a/src/runestone.jl +++ b/src/runestone.jl @@ -2137,7 +2137,7 @@ function indent_module(ctx::Context, node::Node) # Third node is the module identifier id_idx = 3 id_node = kids[id_idx] - @assert kind(id_node) === K"Identifier" + @assert kind(id_node) in KSet"Identifier var" # Fourth node is the module body block. block_idx = 4 block_node′ = indent_block(ctx, kids[block_idx]) diff --git a/test/runtests.jl b/test/runtests.jl index 056d38a..b2a1979 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -571,6 +571,9 @@ end # nested documented modules @test format_string("\"doc\"\n$(b)module A\n\"doc\"\n$(b)module B\n$(sp)x\n$(sp)end\n$(sp)end") == "\"doc\"\n$(b)module A\n\"doc\"\n$(b)module B\n x\nend\nend" + # var"" as module name + @test format_string("$(b)module var\"A\"\n$(sp)x\n$(sp)end\nf") == + "$(b)module var\"A\"\n x\nend\nf" end # tuple @test format_string("(a,\n$(sp)b)") == "(\n a,\n b,\n)"