From ae97068e369077b160d30072be6541f81ab5598d Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 1 Apr 2002 02:59:53 +0000 Subject: [PATCH] Fixed MATCH rule port Changed regex.split to work with MATCH Fixed build-system.jam so command-line JAMFILE specification works [SVN r13326] --- historic/jam/src/builtins.c | 1 + jam_src/builtins.c | 1 + new/build-system.jam | 3 +++ new/regex.jam | 3 ++- v2/util/regex.jam | 3 ++- 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/historic/jam/src/builtins.c b/historic/jam/src/builtins.c index a434fee44..f53ae7c9f 100644 --- a/historic/jam/src/builtins.c +++ b/historic/jam/src/builtins.c @@ -354,6 +354,7 @@ builtin_match( { string_append_range( buf, re->startp[i], re->endp[i] ); result = list_new( result, newstr( buf->value ) ); + string_truncate( buf, 0 ); } string_free( buf ); diff --git a/jam_src/builtins.c b/jam_src/builtins.c index a434fee44..f53ae7c9f 100644 --- a/jam_src/builtins.c +++ b/jam_src/builtins.c @@ -354,6 +354,7 @@ builtin_match( { string_append_range( buf, re->startp[i], re->endp[i] ); result = list_new( result, newstr( buf->value ) ); + string_truncate( buf, 0 ); } string_free( buf ); diff --git a/new/build-system.jam b/new/build-system.jam index ba6ce7ae6..08a58f570 100644 --- a/new/build-system.jam +++ b/new/build-system.jam @@ -13,6 +13,9 @@ rule construct ( module-name ) # Default patterns to search for the Jamfiles to use for build # declarations. # +import modules ; + +JAMFILE = [ modules.peek : JAMFILE ] ; JAMFILE ?= [Jj]amfile [Jj]amfile.jam ; # Load a Jamfile at the given directory. Will attempt to load diff --git a/new/regex.jam b/new/regex.jam index f3cd666d0..bc4f359e7 100644 --- a/new/regex.jam +++ b/new/regex.jam @@ -19,8 +19,9 @@ rule split ( string separator ) local match = 1 ; while $(match) { - match = [ SUBST $(s) ^(.*)($(separator))(.*) $1 $2 $3 ] ; + match = [ MATCH ^(.*)($(separator))(.*) : $(s) ] ; if $(match) { + match += "" ; # in case 3rd item was empty - works around MATCH bug result = $(match[3]) $(result) ; s = $(match[1]) ; } diff --git a/v2/util/regex.jam b/v2/util/regex.jam index f3cd666d0..bc4f359e7 100644 --- a/v2/util/regex.jam +++ b/v2/util/regex.jam @@ -19,8 +19,9 @@ rule split ( string separator ) local match = 1 ; while $(match) { - match = [ SUBST $(s) ^(.*)($(separator))(.*) $1 $2 $3 ] ; + match = [ MATCH ^(.*)($(separator))(.*) : $(s) ] ; if $(match) { + match += "" ; # in case 3rd item was empty - works around MATCH bug result = $(match[3]) $(result) ; s = $(match[1]) ; }