On Wed, 19 Aug 2009, Joel E. Denny wrote:
> diff --git a/src/scan-gram.l b/src/scan-gram.l
> @@ -616,8 +617,12 @@ splice (\\[ \f\t\v]*\n)*
> }
> \\(.|\n) {
> char const *p = yytext + 1;
> - if (*p == ' ')
> - p = "` '";
> + char quoted_ws[] = "` '";
> + if (isspace (*p) && isprint (*p))
> + {
> + quoted_ws[1] = *p;
> + p = quoted_ws;
> + }
> else
> p = quotearg_style_mem (escape_quoting_style, p, 1);
> complain_at (*loc, _("invalid character after \\-escape: %s"), p);
I pushed the following to master, branch-2.5, and branch-2.4.2.
>From e6c849d82a95be8a595c254cc3046cfae725f064 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <[email protected]>
Date: Fri, 21 Aug 2009 20:09:54 -0400
Subject: [PATCH] Use locale when quoting.
* src/scan-gram.l (SC_ESCAPED_STRING, SC_ESCAPED_CHARACTER): Use
quote rather than implementing quoting here.
---
ChangeLog | 6 ++++++
src/scan-gram.l | 7 ++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 33d806f..b831d11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-21 Joel E. Denny <[email protected]>
+
+ Use locale when quoting.
+ * src/scan-gram.l (SC_ESCAPED_STRING, SC_ESCAPED_CHARACTER): Use
+ quote rather than implementing quoting here.
+
2009-08-20 Eric Blake <[email protected]>
Make previous patch more robust.
diff --git a/src/scan-gram.l b/src/scan-gram.l
index 4ed30c6..93e0d10 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -617,12 +617,9 @@ splice (\\[ \f\t\v]*\n)*
}
\\(.|\n) {
char const *p = yytext + 1;
- char quoted_ws[] = "` '";
+ /* Quote only if escaping won't make the character visible. */
if (isspace (*p) && isprint (*p))
- {
- quoted_ws[1] = *p;
- p = quoted_ws;
- }
+ p = quote (p);
else
p = quotearg_style_mem (escape_quoting_style, p, 1);
complain_at (*loc, _("invalid character after \\-escape: %s"), p);
--
1.5.4.3