1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 13:10:33 +02:00

guix: toml: Fix keys with embedded escape codes.

Quoted keys are treated by the specification like ordinary strings,
so escape codes must be handled as well.

* guix/build/toml.scm (eval-value): Move string escape handling…
(eval-value): …here.
(eval-toml-file): Un-escape quoted keys.
* tests/toml.scm ("parse-toml: Quoted keys with escapes"): New testcase.

Fixes: guix/guix#2414
Change-Id: I612e415cc93207bbdd18b6ec8279255fee16670a
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Lars-Dominik Braun
2025-09-01 17:05:23 +02:00
committed by Sharlatan Hellseher
parent 82918e4642
commit d111a6a60d
2 changed files with 24 additions and 12 deletions

View File

@@ -54,6 +54,12 @@ bare-key = \"value\"
'key2' = \"value\"
'quoted \"value\"' = \"value\""))
(test-equal "parse-toml: Quoted keys with escapes"
'(("key \\ with \n escapes" . "value")
("key" ("with \t escapes" ("and \n dots" . "value"))))
(parse-toml "\"key \\\\ with \\n escapes\" = \"value\"
key.\"with \\t escapes\".\"and \\n dots\" = \"value\""))
(test-equal "parse-toml: No key"
#f
(parse-toml "= \"no key name\""))