po: Do not handle escape sequences in PEG patterns.

\n sequences are handled and replaced by the 'interpret-newline-escape'
procedure.  Replacing cannot be done in PEG.

Before, PEG patterns had already dealt with the escaping of backslashes,
making it impossible for 'interpret-newline-escape' to distinguish \n
escape sequences from situations like \\n when the backslash itself is
escaped and thus cannot be part of an \n or \" escape sequence.

* guix/build/po.scm (str-chr): Do not escape characters.

Change-Id: Iae75dc146c55d21b725822780cfe951ef9ffae1e
This commit is contained in:
Florian Pelz 2025-09-16 00:29:33 +02:00
parent 6012fc5f7b
commit 3bc0cf8839
No known key found for this signature in database
GPG key ID: 300888CB39C63817

View file

@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2021 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2019, 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2023 Florian Pelz <pelzflorian@pelzflorian.de> ;;; Copyright © 2023, 2025 Florian Pelz <pelzflorian@pelzflorian.de>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -38,9 +38,9 @@
(and (* (or flags comment (ignore (* whitespace)))) (and (* (or flags comment (ignore (* whitespace))))
(ignore "msgid ") msgid (ignore (* whitespace)) (ignore "msgid ") msgid (ignore (* whitespace))
(ignore "msgstr ") msgstr)) (ignore "msgstr ") msgstr))
(define-peg-pattern escape body (or "\\\\" "\\\"" "\\n")) (define-peg-pattern str-chr body (or " " "!"
(define-peg-pattern str-chr body (or " " "!" (and (ignore "\\") "\"") "\\\\"
"\\n" (and (ignore "\\") "\\") "\\\""
(range #\# #\頋))) (range #\# #\頋)))
(define-peg-pattern msgid all content) (define-peg-pattern msgid all content)
(define-peg-pattern msgstr all content) (define-peg-pattern msgstr all content)