diff options
author | Eric Blake <eblake@redhat.com> | 2010-02-24 16:20:45 -0700 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2010-02-24 16:50:03 -0700 |
commit | 747b093a76d4934534994ddb8c0ddbb33b593f8c (patch) | |
tree | 378b9ef7e31b8dfdd2351619e4bbd3c5a816d502 | |
parent | 2bedb20e510295151457d8759bcd1e34d97af561 (diff) | |
download | m4-747b093a76d4934534994ddb8c0ddbb33b593f8c.tar.gz |
Improve parsing example.
* doc/m4.texinfo (Input processing): Double-quote argument to
translit, for robustness.
* THANKS: Update.
Reported by Chris Penev.
Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit b4f66285d8252196e1b4c6acf55eda3c1118e580)
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | doc/m4.texinfo | 15 |
3 files changed, 18 insertions, 6 deletions
@@ -1,3 +1,11 @@ +2010-02-24 Eric Blake <eblake@redhat.com> + + Improve parsing example. + * doc/m4.texinfo (Input processing): Double-quote argument to + translit, for robustness. + * THANKS: Update. + Reported by Chris Penev. + 2010-01-29 Eric Blake <ebb9@byu.net> Document upcoming release. @@ -33,6 +33,7 @@ Bruno Haible bruno@clisp.org Cesar Strauss cestrauss@gmail.com Charles Wilson cygwin@cwilson.fastmail.fm Chris McGuire chris@wso.net +Chris Penev xpenev@gmail.com Damian Menscher menscher@uiuc.edu Dan Jacobson jidanni@jidanni.org Daniel Richard G. skunk@iskunk.org diff --git a/doc/m4.texinfo b/doc/m4.texinfo index 2d4a81b9..fa0c6fda 100644 --- a/doc/m4.texinfo +++ b/doc/m4.texinfo @@ -1392,13 +1392,15 @@ whitespace so that less whitespace is output (which, although harmless to shell scripts, can be visually unappealing), and fixes the quoting issues so that the capitalization occurs when the macro @samp{gl_STRING_MODULE_INDICATOR} is invoked, rather then when it is -defined. +defined. It also adds another layer of quoting to the first argument of +@code{translit}, to ensure that the output will be rescanned as a string +rather than a potential uppercase macro name needing further expansion. @example changequote([,])dnl define([gl_STRING_MODULE_INDICATOR], [dnl comment - GNULIB_[]translit([$1], [a-z], [A-Z])=1dnl + GNULIB_[]translit([[$1]], [a-z], [A-Z])=1dnl ])dnl gl_STRING_MODULE_INDICATOR([strcase]) @result{} GNULIB_STRCASE=1 @@ -1407,7 +1409,7 @@ define([gl_STRING_MODULE_INDICATOR], The parsing of the first line is unchanged. The second line sees the name of the macro to define, then sees the discarded @samp{@key{NL}} and two spaces, as before. But this time, the next token is -@samp{[dnl comment@key{NL}@ @ GNULIB_[]translit([$1], [a-z], +@samp{[dnl comment@key{NL}@ @ GNULIB_[]translit([[$1]], [a-z], [A-Z])=1dnl@key{NL}]}, which includes nested quotes, followed by @samp{)} to end the macro definition and @samp{dnl} to skip the newline. No early expansion of @code{translit} occurs, so the entire @@ -1424,10 +1426,11 @@ output literally. The token @samp{[]} is an empty string, so it does not affect output. Then the token @samp{translit} is encountered. This time, the arguments to @code{translit} are parsed as @samp{(}, -@samp{[strcase]}, @samp{,}, @samp{ }, @samp{[a-z]}, @samp{,}, @samp{ }, +@samp{[[strcase]]}, @samp{,}, @samp{ }, @samp{[a-z]}, @samp{,}, @samp{ }, @samp{[A-Z]}, and @samp{)}. The two spaces are discarded, and the -translit results in the desired result @samp{STRCASE}. This is -rescanned, but since it is not a macro name, it is output literally. +translit results in the desired result @samp{[STRCASE]}. This is +rescanned, but since it is a string, the quotes are stripped and the +only output is a literal @samp{STRCASE}. Then the scanner sees @samp{=} and @samp{1}, which are output literally, followed by @samp{dnl} which discards the rest of the definition of @code{gl_STRING_MODULE_INDICATOR}. The newline at the |