@@ -501,13 +501,31 @@ Return an object of type ‘elisp/runfiles/runfiles--manifest’."
501
501
; ; Perform the same parsing as
502
502
; ; https://github.com/bazelbuild/bazel/blob/6.4.0/tools/cpp/runfiles/runfiles_src.cc#L241.
503
503
(while (not (eobp ))
504
- (pcase (buffer-substring-no-properties (point ) (line-end-position ))
505
- ((rx bos (let key (+ (not (any ?\n ?\s ))))
506
- ?\s (let value (* nonl)) eos)
507
- ; ; Runfiles are always local, so quote them unconditionally.
508
- (puthash key (if (string-empty-p value) :empty (concat " /:" value))
509
- manifest))
510
- (other (signal 'elisp/runfiles/syntax-error (list filename other))))
504
+ (let ((line (buffer-substring-no-properties
505
+ (point ) (line-end-position )))
506
+ (escaped (eql (following-char ) ?\s )))
507
+ (cl-flet* ((syntax-error ()
508
+ (signal 'elisp/runfiles/syntax-error
509
+ (list filename line)))
510
+ (unescape (string &rest other)
511
+ (let ((pairs `(,@other (" \\ n" . " \n " ) (" \\ b" . " \\ " ))))
512
+ (replace-regexp-in-string
513
+ (rx ?\\ (? anychar))
514
+ (lambda (seq )
515
+ (or (cdr (assoc seq pairs)) (syntax-error)))
516
+ string :fixedcase :literal ))))
517
+ (pcase (if escaped (substring-no-properties line 1 ) line)
518
+ ((rx bos (let key (+ (not (any ?\n ?\s ))))
519
+ ?\s (let value (* nonl)) eos)
520
+ (when escaped
521
+ (cl-callf unescape key '(" \\ s" . " " ))
522
+ (cl-callf unescape value))
523
+ (puthash key
524
+ ; ; Runfiles are always local, so quote them
525
+ ; ; unconditionally.
526
+ (if (string-empty-p value) :empty (concat " /:" value))
527
+ manifest))
528
+ (_ (syntax-error)))))
511
529
(forward-line )))
512
530
(elisp/runfiles/manifest--make filename manifest)))
513
531
0 commit comments