Re: speed up input parsing

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 2/13/2009 6:09 AM:
> While working on argv_ref patch 29, I noticed that the master branch had a
> variable input_change which was always true.  This has been the case ever
> since it was introduced in commit 3883a on 2006-10-25; even though that
> patch was copied from the branch where the variable is properly cleared.

Another stupid one-liner porting bug on my part, this time from commit
726430.  I hadn't noticed it before because autoconf only uses symmetric
multi-character quotes (start and end quote always have the same length).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmZakwACgkQ84KuGfSFAYADFgCgwo29d4GTMD2ce0geSJhJc7KF
T6kAn2U+Fr0N8eVJlWq3Zri4HD4fHWWi
=MU9L
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch398 (text/plain, 1.7 KB)
From 9b0812943d025b46fbed585adce8ff11acb39d3a Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Mon, 16 Feb 2009 06:21:20 -0700
Subject: [PATCH] Fix regression in multicharacter quotes, from 2008-01-25.

* m4/input.c (m4__next_token): Fix typo.
* tests/builtins.at (changequote): Enhance test.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog         |    6 ++++++
 m4/input.c        |    2 +-
 tests/builtins.at |    4 ++++
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6717a8a..8997569 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-16  Eric Blake  <[email protected]>
+
+	Fix regression in multicharacter quotes, from 2008-01-25.
+	* m4/input.c (m4__next_token): Fix typo.
+	* tests/builtins.at (changequote): Enhance test.
+
 2009-02-13  Eric Blake  <[email protected]>

 	Speed up parsing when detecting input file change.
diff --git a/m4/input.c b/m4/input.c
index 2672386..ba2e467 100644
--- a/m4/input.c
+++ b/m4/input.c
@@ -1678,7 +1678,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line,
 	      {
 		quote_level++;
 		obstack_grow (obs_safe, context->syntax->quote.str1,
-			      context->syntax->quote.len2);
+			      context->syntax->quote.len1);
 	      }
 	    else
 	      obstack_1grow (obs_safe, ch);
diff --git a/tests/builtins.at b/tests/builtins.at
index 397f649..46ce548 100644
--- a/tests/builtins.at
+++ b/tests/builtins.at
@@ -133,11 +133,15 @@ AT_DATA([in.m4],
 [[define(`aaaaaaaaaaaaaaaaaaaa', `A')define(`q', `"$@"')
 changequote(`"', `"')
 q(q("aaaaaaaaaaaaaaaaaaaa", "a"))
+changequote`'define(`echo', `$@')dnl
+changequote(`<<<', `>>')dnl
+echo(<<<a<<<b>>>>)
 ]])

 AT_CHECK_M4([in.m4], [0], [[

 A,a
+a<<<b>>
 ]])

 AT_CLEANUP
-- 
1.6.1.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.