[PATCH] Make ASSIGNMENT_PATTERN less greedy

2001-05-12 Thread Raja R Harinath

Hi,

The recently added ASSIGNMENT_PATTERN is a little too greedy.  Given

FOO=-DBAR=baz

it incorrectly matches the macro name to be 'FOO=-DBAR' rather than
just 'FOO'.

Here's an obvious fix, and a possible testcase.



from  Raja R Harinath  [EMAIL PROTECTED]

	* automake.in (ASSIGNMENT_PATTERN): Make variable-name pattern 
	stop at the first '='.

Index: automake.in
===
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.
diff -u -p -u -r1. automake.in
--- automake.in	2001/05/12 12:36:03	1.
+++ automake.in	2001/05/12 23:31:43
@@ -125,7 +125,7 @@ my $SUFFIX_RULE_PATTERN = '^\.([a-zA-Z0-
 # leading tabs here then we need to make the reader smarter, because
 # otherwise it will think rules like `foo=bar; \' are errors.
 my $MACRO_PATTERN = '^[A-Za-z0-9_@]+$';
-my $ASSIGNMENT_PATTERN = '^ *([^ \t]*)\s*([:+]?)=\s*(.*)$';
+my $ASSIGNMENT_PATTERN = '^ *([^ \t=]*)\s*([:+]?)=\s*(.*)$';
 # This pattern recognizes a Gnits version id and sets $1 if the
 # release is an alpha release.  We also allow a suffix which can be
 # used to extend the version number with a fork identifier.


#! /bin/sh

# Test various variable definitions that include an '=' sign

. $srcdir/defs || exit 1

cat  Makefile.am  'END'
MY_FLAGS_1=-DABC=345
MY_FLAGS_2= -DABC=345
MY_FLAGS_3 =-DABC=345
MY_FLAGS_4 = -DABC=345
END

$AUTOMAKE || exit 1

exit 0



- Hari
-- 
Raja R Harinath -- [EMAIL PROTECTED]
When all else fails, read the instructions.  -- Cahn's Axiom
Our policy is, when in doubt, do the right thing.   -- Roy L Ash



Re: [PATCH] Make ASSIGNMENT_PATTERN less greedy

2001-05-12 Thread Tom Tromey

  == Raja R Harinath [EMAIL PROTECTED] writes:

 from  Raja R Harinath  [EMAIL PROTECTED]
  * automake.in (ASSIGNMENT_PATTERN): Make variable-name pattern 
  stop at the first '='.

Thanks, I checked this in.

Tom