~ruther/guix-local

3bc0cf8839fde579dea398c04250a0c86f112e9e — Florian Pelz 6 months ago 6012fc5
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
1 files changed, 4 insertions(+), 4 deletions(-)

M guix/build/po.scm
M guix/build/po.scm => guix/build/po.scm +4 -4
@@ 1,7 1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2021 Julien Lepiller <julien@lepiller.eu>
;;; 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.
;;;


@@ 38,9 38,9 @@
  (and (* (or flags comment (ignore (* whitespace))))
       (ignore "msgid ") msgid (ignore (* whitespace))
       (ignore "msgstr ") msgstr))
(define-peg-pattern escape body (or "\\\\" "\\\"" "\\n"))
(define-peg-pattern str-chr body (or " " "!" (and (ignore "\\") "\"")
                                     "\\n" (and (ignore "\\") "\\")
(define-peg-pattern str-chr body (or " " "!"
                                     "\\\\"
                                     "\\\""
                                     (range #\# #\頋)))
(define-peg-pattern msgid all content)
(define-peg-pattern msgstr all content)