m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU M4 source repository branch, branch-1_4, updated. v1.4.10-24-g


From: Eric Blake
Subject: [SCM] GNU M4 source repository branch, branch-1_4, updated. v1.4.10-24-g37e491a
Date: Sat, 27 Oct 2007 12:24:52 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU M4 source repository".

http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=37e491acd84f447920057b1619ebab148adea8b1

The branch, branch-1_4 has been updated
       via  37e491acd84f447920057b1619ebab148adea8b1 (commit)
      from  ca29cce1e8916d486ead21ced371049f9e6a2085 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 37e491acd84f447920057b1619ebab148adea8b1
Author: Eric Blake <address@hidden>
Date:   Sat Oct 27 06:15:51 2007 -0600

    Document one use of changequote(`(',`)').
    
    * doc/m4.texinfo (Changequote): Add new test, based on recent
    autoconf addition of m4_expand.
    
    Signed-off-by: Eric Blake <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    6 ++++++
 doc/m4.texinfo |   28 ++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fc86c30..992ae22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-27  Eric Blake  <address@hidden>
+
+       Document one use of changequote(`(',`)').
+       * doc/m4.texinfo (Changequote): Add new test, based on recent
+       autoconf addition of m4_expand.
+
 2007-10-24  Ralf Wildenhues  <address@hidden>
 
        * examples/Makefile.am (EXTRA_DIST): Add capitalize2.m4.
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 4aea90a..677c859 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -3527,6 +3527,34 @@ echo(hi,hi)bye)
 @result{}1:HIhibye:
 @end example
 
+However, if you are not worried about portability, using @samp{(} and
address@hidden)} as quoting characters has an interesting property---you can use
+it to compute a quoted string containing the expansion of any quoted
+text, as long as the expansion results in both balanced quotes and
+balanced parentheses.  The trick is realizing @code{expand} uses
address@hidden unquoted, to trigger its expansion using the normal quoting
+characters, but uses extra parentheses to group unquoted commas that
+occur in the expansion without consuming whitespace following those
+commas.  Then @code{_expand} uses @code{changequote} to convert the
+extra parentheses back into quoting characters.  Note that it takes two
+more @code{changequote} invocations to restore the original quotes.
+Contrast the behavior on whitespace when using @samp{$*}, via
address@hidden, to attempt the same task.
+
address@hidden
+changequote(`[', `]')dnl
+define([a], [1, (b)])dnl
+define([b], [2])dnl
+define([quote], [[$*]])dnl
+define([expand], [_$0(($1))])dnl
+define([_expand],
+  [changequote([(], [)])$1changequote`'changequote(`[', `]')])dnl
+expand([a, a, [a, a], [[a, a]]])
address@hidden, (2), 1, (2), a, a, [a, a]
+quote(a, a, [a, a], [[a, a]])
address@hidden,(2),1,(2),a, a,[a, a]
address@hidden example
+
 If @var{end} is a prefix of @var{start}, the end-quote will be
 recognized in preference to a nested begin-quote.  In particular,
 changing the quotes to have the same string for @var{start} and


hooks/post-receive
--
GNU M4 source repository




reply via email to

[Prev in Thread] Current Thread [Next in Thread]