aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/c/unlex.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/module/c/unlex.scm b/module/c/unlex.scm
index e714816d..1f8ba0a1 100644
--- a/module/c/unlex.scm
+++ b/module/c/unlex.scm
@@ -4,6 +4,7 @@
:use-module (c lex2)
:use-module (c cpp-types)
:use-module (c cpp-util)
+ :use-module ((texinfo string-utils) :select (escape-special-chars))
:export (unlex
unlex-aggressive
stringify-token
@@ -47,7 +48,11 @@
(for-each (match-lambda
(`(escape-sequence ,x)
(display (stringify-escape-sequence x)))
- (s (display s)))
+ ;; Backslash in source strings is usually encoded by an
+ ;; 'escape-sequence, but literal backslashes can be in
+ ;; "regular" string fragments as result of the stringification
+ ;; operator (#).
+ (s (display (escape-special-chars s "\"\\" #\\))))
fragments)
(display #\"))))